package com.hxhq.common.ad;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author yuyantian
 * @date 2026/2/11
 * @desc
 */
/**
 * AD域控配置类（绑定application.yml中的hxhq.ad配置）
 */
@Component
@ConfigurationProperties(prefix = "hxhq.ad")
public class ADProperties {
    // 服务器地址
    private String serverHost;
    // 端口
    private int serverPort = 389;
    // 基础DN
    private String baseDn;
    // 是否启用SSL
    private boolean useSsl = false;
    // 连接超时
    private int connectTimeout = 5000;
    // 只读账号子配置
    private ReadOnly readOnly = new ReadOnly();

    // 内部类：只读账号配置
    public static class ReadOnly {
        private String username;
        private String password;

        // Getter & Setter
        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }
    }

    // Getter & Setter
    public String getServerHost() {
        return serverHost;
    }

    public void setServerHost(String serverHost) {
        this.serverHost = serverHost;
    }

    public int getServerPort() {
        return serverPort;
    }

    public void setServerPort(int serverPort) {
        this.serverPort = serverPort;
    }

    public String getBaseDn() {
        return baseDn;
    }

    public void setBaseDn(String baseDn) {
        this.baseDn = baseDn;
    }

    public boolean isUseSsl() {
        return useSsl;
    }

    public void setUseSsl(boolean useSsl) {
        this.useSsl = useSsl;
    }

    public int getConnectTimeout() {
        return connectTimeout;
    }

    public void setConnectTimeout(int connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public ReadOnly getReadOnly() {
        return readOnly;
    }

    public void setReadOnly(ReadOnly readOnly) {
        this.readOnly = readOnly;

    }
}