package com.heyu.api.tencent.handle;


import com.heyu.api.data.utils.StringUtils;
import com.heyu.api.tencent.TencentBaseHandle;
import com.tencentcloudapi.faceid.v20180301.FaceidClient;
import com.tencentcloudapi.faceid.v20180301.models.MinorsVerificationRequest;
import com.tencentcloudapi.faceid.v20180301.models.MinorsVerificationResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/***
 * https://console.cloud.tencent.com/api/explorer?Product=faceid&Version=2018-03-01&Action=MinorsVerification
 *
 * 手机号实名查询
 */
@Component
public class TMinorsVerificationHandle extends TencentBaseHandle<MinorsVerificationRequest, MinorsVerificationResponse> {
    @Autowired
    private FaceidClient client;

    @Override
    public String check(MinorsVerificationRequest tMinorsVerificationRequest) {
        if (StringUtils.isBlank(tMinorsVerificationRequest.getMobile())) {
            return "手机号不能为空";
        }
        return null;
    }

    @Override
    public MinorsVerificationResponse run(MinorsVerificationRequest ap) throws Exception {

        return client.MinorsVerification(ap);
    }
}
