using Hotline.Share.Enums.Early;
using SqlSugar;
using XF.Domain.Repository;

namespace Hotline.Early
{
    public class EarlyWarningSetting: FullStateEntity
    {
        /// <summary>
        /// 预警名称
        /// </summary>
        public string EarlyWarningName { get; set; }

        /// <summary>
        /// 预警级别值
        /// </summary>
        public string EarlyWarningLevelValue { get; set; }

        /// <summary>
        /// 预警级别名称
        /// </summary>
        public string EarlyWarningLevelName { get; set; }

        /// <summary>
        /// 预警类型值
        /// </summary>
        public string EarlyWarningTypeValue { get; set; }

        /// <summary>
        /// 预警类型名称
        /// </summary>
        public string EarlyWarningTypeName { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnable { get; set; }

        /// <summary>
        /// 预警原因
        /// </summary>
        public string EarlyWarningRemark { get; set; }

        /// <summary>
        /// 预警规则
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public List<EarlyWarningRule> EarlyWarningRules { get; set; }

        /// <summary>
        /// 频率
        /// </summary>
        public EFrequency Frequency { get; set; }
    }

    public class EarlyWarningRule
    {
        /// <summary>
        /// 敏感词
        /// </summary>
        public string SensitiveWord { get; set; }

        /// <summary>
        /// 比较方式
        /// </summary>
        public ECompareType CompareType { get; set; }

        /// <summary>
        /// 次数
        /// </summary>
        public int Times { get; set; }

        /// <summary>
        /// 顺序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 下一节点条件
        /// </summary>
        public ENextWhere? NextWhere { get; set; }
    }
}
