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


import com.aliyun.imageenhan20190930.models.ImageBlindCharacterWatermarkRequest;
import com.aliyun.imageenhan20190930.models.ImageBlindCharacterWatermarkResponse;
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.AImageDecodeBlindCharacterWatermarkRequest;
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/ImageBlindCharacterWatermark
 * 图像隐形文字水印
 * <p>
 * ImageBlindCharacterWatermark
 */
@Component
@Slf4j
@CustomPath("imageEncodeBlindCharacterWatermark")
public class AImageDecodeBlindCharacterWatermarkHandle extends AlibabaBaseHandle<AImageDecodeBlindCharacterWatermarkRequest, ImageBlindCharacterWatermarkResponse> {

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

    @Override
    public String check(AImageDecodeBlindCharacterWatermarkRequest aImageBlindCharacterWatermarkRequest) {
        return checkUrlBase64(aImageBlindCharacterWatermarkRequest);
    }

    @Override
    public ImageBlindCharacterWatermarkResponse run(AImageDecodeBlindCharacterWatermarkRequest aImageBlindCharacterWatermarkRequest, RuntimeOptions runtime) throws Exception {
        ImageBlindCharacterWatermarkRequest imageBlindCharacterWatermarkRequest = new ImageBlindCharacterWatermarkRequest();
        imageBlindCharacterWatermarkRequest.setWatermarkImageURL(aImageBlindCharacterWatermarkRequest.getImageUrl());
        imageBlindCharacterWatermarkRequest.setFunctionType(aImageBlindCharacterWatermarkRequest.getFunctionType());
        return client.imageBlindCharacterWatermarkWithOptions(imageBlindCharacterWatermarkRequest, runtime);
    }
}
