package org.xyzh.auth.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.ArrayList;

/**
 * @description    AuthProperties.java文件描述 认证配置属性
 * @filename    AuthProperties.java
 * @author    yslg
 * @copyright xyzh
 * @since 2025-09-28
 */
@Component
@ConfigurationProperties(prefix = "school-news.auth")
public class AuthProperties {

    /**
     * @description    免登录白名单路径
     * @author    yslg
     * @since 2025-09-28
     */
    private List<String> whiteList = new ArrayList<>();

    /**
     * @description    JWT密钥
     * @author    yslg
     * @since 2025-09-28
     */
    private String jwtSecret = "schoolNewsDefaultSecretKeyForJWT2025";

    /**
     * @description    JWT过期时间（秒）
     * @author    yslg
     * @since 2025-09-28
     */
    private Long jwtExpiration = 86400L;

    /**
     * @description    最大登录失败次数
     * @author    yslg
     * @since 2025-09-28
     */
    private Integer maxLoginAttempts = 5;

    /**
     * @description    账户锁定时间（分钟）
     * @author    yslg
     * @since 2025-09-28
     */
    private Integer lockoutDuration = 30;

    /**
     * @description    获取白名单
     * @return    List<String> 白名单路径列表
     * @author    yslg
     * @since 2025-09-28
     */
    public List<String> getWhiteList() {
        return whiteList;
    }

    /**
     * @description    设置白名单
     * @param    whiteList 白名单路径列表
     * @author    yslg
     * @since 2025-09-28
     */
    public void setWhiteList(List<String> whiteList) {
        this.whiteList = whiteList;
    }

    /**
     * @description    获取JWT密钥
     * @return    String JWT密钥
     * @author    yslg
     * @since 2025-09-28
     */
    public String getJwtSecret() {
        return jwtSecret;
    }

    /**
     * @description    设置JWT密钥
     * @param    jwtSecret JWT密钥
     * @author    yslg
     * @since 2025-09-28
     */
    public void setJwtSecret(String jwtSecret) {
        this.jwtSecret = jwtSecret;
    }

    /**
     * @description    获取JWT过期时间
     * @return    Long JWT过期时间（秒）
     * @author    yslg
     * @since 2025-09-28
     */
    public Long getJwtExpiration() {
        return jwtExpiration;
    }

    /**
     * @description    设置JWT过期时间
     * @param    jwtExpiration JWT过期时间（秒）
     * @author    yslg
     * @since 2025-09-28
     */
    public void setJwtExpiration(Long jwtExpiration) {
        this.jwtExpiration = jwtExpiration;
    }

    /**
     * @description    获取最大登录失败次数
     * @return    Integer 最大登录失败次数
     * @author    yslg
     * @since 2025-09-28
     */
    public Integer getMaxLoginAttempts() {
        return maxLoginAttempts;
    }

    /**
     * @description    设置最大登录失败次数
     * @param    maxLoginAttempts 最大登录失败次数
     * @author    yslg
     * @since 2025-09-28
     */
    public void setMaxLoginAttempts(Integer maxLoginAttempts) {
        this.maxLoginAttempts = maxLoginAttempts;
    }

    /**
     * @description    获取账户锁定时间
     * @return    Integer 账户锁定时间（分钟）
     * @author    yslg
     * @since 2025-09-28
     */
    public Integer getLockoutDuration() {
        return lockoutDuration;
    }

    /**
     * @description    设置账户锁定时间
     * @param    lockoutDuration 账户锁定时间（分钟）
     * @author    yslg
     * @since 2025-09-28
     */
    public void setLockoutDuration(Integer lockoutDuration) {
        this.lockoutDuration = lockoutDuration;
    }
}
