package com.dora.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 阿里云身份认证服务(CloudAuth)配置类
 * 
 * 注意：当前为简化配置，生产环境中应该配置真实的阿里云SDK客户端
 *
 * @author Dora
 */
@Configuration
@ConfigurationProperties(prefix = "aliyun.cloudauth")
@Data
@Slf4j
public class CloudAuthConfig {

    /**
     * 地域ID
     */
    private String region = "ap-southeast-1";

    /**
     * 服务端点
     */
    private String endpoint = "cloudauth.ap-southeast-1.aliyuncs.com";

    /**
     * AccessKey ID
     */
    private String accessKeyId;

    /**
     * AccessKey Secret
     */
    private String accessKeySecret;

    /**
     * 连接超时时间（毫秒）
     */
    private Integer connectionTimeout = 10000;

    /**
     * 响应超时时间（毫秒）
     */
    private Integer responseTimeout = 10000;

    /**
     * 初始化后日志记录
     */
    public void init() {
        log.info("CloudAuth配置初始化完成 - 区域: {}, 端点: {}", region, endpoint);
        if (accessKeyId != null && !accessKeyId.isEmpty()) {
            log.info("AccessKeyId已配置: {}****", accessKeyId.substring(0, Math.min(4, accessKeyId.length())));
        } else {
            log.warn("AccessKeyId未配置，请在application.yml中配置aliyun.cloudauth.access-key-id");
        }
    }
}