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


import com.aliyun.imageenhan20190930.models.EnhanceImageColorRequest;
import com.aliyun.imageenhan20190930.models.EnhanceImageColorResponse;
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.imageenhan.AEnhanceImageColorRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * https://next.api.aliyun.com/api/imageenhan/2019-09-30/EnhanceImageColor?tab=DOC
 * <p>
 * 图像色彩增强
 * <p>
 * EnhancelmageColor
 */
@Component
@Slf4j
@CustomPath("enhanceImageColor")
public class AEnhanceImageColorHandle extends AlibabaBaseHandle<AEnhanceImageColorRequest, EnhanceImageColorResponse> {


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

    @Override
    public String check(AEnhanceImageColorRequest aEnhanceImageColorRequest) {
        return checkUrlBase64(aEnhanceImageColorRequest);
    }


    @Override
    public EnhanceImageColorResponse run(AEnhanceImageColorRequest aEnhanceImageColorRequest, RuntimeOptions runtime) throws Exception {
        EnhanceImageColorRequest enhanceImageColorRequest = new EnhanceImageColorRequest();
        enhanceImageColorRequest.setImageURL(aEnhanceImageColorRequest.getImageUrl());
        enhanceImageColorRequest.setMode(aEnhanceImageColorRequest.getMode());
        enhanceImageColorRequest.setOutputFormat(enhanceImageColorRequest.getOutputFormat());
        // 复制代码运行请自行打印 API 的返回值
        return client.enhanceImageColorWithOptions(enhanceImageColorRequest, runtime);
    }
}
