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

import com.aliyun.imageenhan20190930.models.ColorizeImageRequest;
import com.aliyun.imageenhan20190930.models.ColorizeImageResponse;
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.AColorizeImageRequest;
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/ColorizeImage?tab=DEMO&lang=JAVA
 * <p>
 * 图片上色
 * <p>
 * Colorizelmage
 */
@Component
@Slf4j
@CustomPath("colorizeImage")
public class AColorizeImageHandle extends AlibabaBaseHandle<AColorizeImageRequest, ColorizeImageResponse> {

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


    @Override
    public String check(AColorizeImageRequest aColorizeImageRequest) {
        return checkUrlBase64(aColorizeImageRequest);
    }



    @Override
    public ColorizeImageResponse run(AColorizeImageRequest aColorizeImageRequest, RuntimeOptions runtime) throws Exception {
        ColorizeImageRequest colorizeImageRequest = new ColorizeImageRequest();
        colorizeImageRequest.setImageURL(aColorizeImageRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.colorizeImageWithOptions(colorizeImageRequest, runtime);
    }
}
