package com.zcloud.basic.info.domain.config;

import cn.hutool.json.JSONObject;
import com.zcloud.gbscommon.dahuaDevice.DaHuaDeviceCommon;
import com.zcloud.gbscommon.dahuaDevice.DhuaConfig;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @author zhangyue
 * 大华对接
 * @date 2026/4/20 13:46
 */

@Component
@ConfigurationProperties(prefix = "dahua.config")
@Data
public class DaHuaConfig {
    private Integer dockFlag;
    private String prefix;
    private String username;
    private String password;
    private String clientId;
    private String clientSecret;

    protected DaHuaDeviceCommon getDaHuaDeviceCommon() {
        return new DaHuaDeviceCommon(new DhuaConfig(dockFlag, prefix, username, password, clientId, clientSecret));
    }

    public JSONObject imageQualityDetection(String base64ImgStr) throws Exception {
        return getDaHuaDeviceCommon().imageQualityDetection(base64ImgStr);
    }
    public JSONObject uploadPersonAvatar(String base64ImgStr) throws Exception {
        return getDaHuaDeviceCommon().uploadPersonAvatar(base64ImgStr);
    }
}
