package com.heyu.api.alibaba.handle.goodstech;

import com.aliyun.goodstech20191230.models.ClassifyCommodityRequest;
import com.aliyun.goodstech20191230.models.ClassifyCommodityResponse;
import com.aliyun.teautil.models.RuntimeOptions;
import com.heyu.api.data.annotation.CustomPath;
import com.heyu.api.alibaba.AlibabaBaseHandle;
import com.heyu.api.alibaba.request.goodstech.AClassifyCommodityRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 *https://next.api.aliyun.com/api/goodstech/2019-12-30/ClassifyCommodity?lang=JAVA&RegionId=cn-shanghai&tab=DEMO
 * <p>
 * 商品分类
 */
@Component
@Slf4j
@CustomPath("classifyCommodity")
public class AClassifyCommodityHandle extends AlibabaBaseHandle<AClassifyCommodityRequest, ClassifyCommodityResponse> {


    @Autowired
    private com.aliyun.goodstech20191230.Client client;

    @Override
    public String check(AClassifyCommodityRequest aClassifyCommodityRequest) {

        return checkUrlBase64(aClassifyCommodityRequest);
    }



    @Override
    public ClassifyCommodityResponse run(AClassifyCommodityRequest aClassifyCommodityRequest, RuntimeOptions runtime) throws Exception {
        ClassifyCommodityRequest classifyCommodityRequest  = new ClassifyCommodityRequest();
        classifyCommodityRequest.setImageURL(aClassifyCommodityRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.classifyCommodityWithOptions(classifyCommodityRequest, runtime);
    }
}
