package com.zcloud.primeport.domain.config;

import com.dahuatech.icc.oauth.model.v202010.OauthConfigUserPwdInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description:
 * @Date: 2026/7/2
 * @User: tianxinlei
 */
@Configuration
public class DaHuaSdkConfig {

    private final DaHuaOauthProperties dahuaOauthProperties;

    // 构造注入配置属性
    public DaHuaSdkConfig(DaHuaOauthProperties dahuaOauthProperties) {
        this.dahuaOauthProperties = dahuaOauthProperties;
    }

    @Bean
    public OauthConfigUserPwdInfo daHuaOauthConfig() {
        return new OauthConfigUserPwdInfo(
                dahuaOauthProperties.getHost(),
                dahuaOauthProperties.getClientId(),
                dahuaOauthProperties.getClientSecret(),
                dahuaOauthProperties.getUsername(),
                dahuaOauthProperties.getPassword(),
                dahuaOauthProperties.isHttp(),
                dahuaOauthProperties.getPort()
        );
    }
}
