package com.erp.inventory.config;

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

/**
 * 预警通知配置属性
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "erp.warning-notification")
public class WarningNotificationProperties {

    /**
     * 是否启用系统通知
     */
    private Boolean systemEnabled = true;

    /**
     * 是否启用邮件通知
     */
    private Boolean emailEnabled = false;

    /**
     * 是否启用钉钉通知
     */
    private Boolean dingtalkEnabled = false;

    /**
     * 邮件配置
     */
    private EmailConfig email = new EmailConfig();

    /**
     * 钉钉配置
     */
    private DingTalkConfig dingtalk = new DingTalkConfig();

    /**
     * 邮件配置
     */
    @Data
    public static class EmailConfig {
        /**
         * SMTP服务器地址
         */
        private String host;

        /**
         * SMTP端口
         */
        private Integer port = 587;

        /**
         * 用户名
         */
        private String username;

        /**
         * 密码
         */
        private String password;

        /**
         * 发件人邮箱
         */
        private String fromEmail;

        /**
         * 发件人名称
         */
        private String fromName;

        /**
         * 是否使用TLS
         */
        private Boolean useTls = true;
    }

    /**
     * 钉钉配置
     */
    @Data
    public static class DingTalkConfig {
        /**
         * 默认Webhook URL
         */
        private String webhookUrl;

        /**
         * 默认Secret
         */
        private String secret;
    }
}
