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


import com.aliyun.imageenhan20190930.models.ImageBlindPicWatermarkRequest;
import com.aliyun.imageenhan20190930.models.ImageBlindPicWatermarkResponse;
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.AImageDecodeBlindPicWatermarkRequest;
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/ImageBlindPicWatermark?tab=DEMO&lang=JAVA
 * <p>
 * 风格迁移
 * <p>
 * 图像隐形图片水印
 * <p>
 * ImageBlindPicWatermark
 */
@Component
@Slf4j
@CustomPath("imageDecodeBlindPicWatermark")
public class AImageDecodeBlindPicWatermarkHandle extends AlibabaBaseHandle<AImageDecodeBlindPicWatermarkRequest, ImageBlindPicWatermarkResponse> {

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

    @Override
    public String check(AImageDecodeBlindPicWatermarkRequest aImageDecodeBlindPicWatermarkRequest) {
        return checkUrlBase64(aImageDecodeBlindPicWatermarkRequest);
    }


    @Override
    public ImageBlindPicWatermarkResponse run(AImageDecodeBlindPicWatermarkRequest aImageDecodeBlindPicWatermarkRequest, RuntimeOptions runtime) throws Exception {
        ImageBlindPicWatermarkRequest imageBlindPicWatermarkRequest = new ImageBlindPicWatermarkRequest();
        imageBlindPicWatermarkRequest.setWatermarkImageURL(aImageDecodeBlindPicWatermarkRequest.getImageUrl());
        imageBlindPicWatermarkRequest.setFunctionType(aImageDecodeBlindPicWatermarkRequest.getFunctionType());
        // 复制代码运行请自行打印 API 的返回值
        return client.imageBlindPicWatermarkWithOptions(imageBlindPicWatermarkRequest, runtime);
    }
}
