using dodohold.core;
using System.Text.Json.Serialization;
using YunhuiKit;

namespace molilian.core
{
    [Table("tk_override_rules")]
    public class OverrideRuleDTO
    {
        [Key]

        public int id { get; set; }
        public string platform { get; set; } = string.Empty;
        public string original_text { get; set; } = string.Empty;
        public string rule { get; set; } = string.Empty;
        public string output_text { get; set; } = string.Empty;
        public string output_type { get; set; } = string.Empty;
        [JsonConverter(typeof(NumericBooleanConverter))]
        public bool status { get; set; }
        [IgnoreUpdate]
        [JsonConverter(typeof(NullableDateTimeConverter))]
        public DateTime create_time { get; set; }
        [JsonConverter(typeof(NullableDateTimeConverter))]
        public DateTime last_time { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string description { get; set; } = string.Empty;
        [JsonConverter(typeof(NumericBooleanConverter))]

        public bool use_risk_control { get; set; }

        /// <summary>
        /// 每日最高调用次数限制
        /// </summary>
        public int daily_calls_limit { get; set; } = 0;

        /// <summary>
        /// 每小时最高调用次数限制
        /// </summary>
        public int hourly_calls_limit { get; set; } = 0;


        [IgnoreInsert, IgnoreUpdate]
        public int current_daily_calls { get; set; } = 0;
        [IgnoreInsert, IgnoreUpdate]
        public int current_hourly_calls { get; set; } = 0;

        /// <summary>
        /// 是否验证参数：0不限制， 1入参special_text=1 时才匹配
        /// </summary>
        public int use_special_text { get; set; }
        public int sort { get; set; }

    }
}
