using System;
using System.Collections.Generic;
using FreeSql.DataAnnotations;
using ZhonTai.Admin.Core.Entities;
using NPP.SmartSchedue.Api.Contracts.Core.Consts;

namespace NPP.SmartSchedue.Api.Contracts.Domain.Time;

/// <summary>
/// 班次规则配置
/// </summary>
[Table(Name = DbConsts.TableNamePrefix + "shift_rule")]
[Index("ix_shiftrule_type_enabled", nameof(RuleType))]
[Index("ix_shiftrule_effective_time", nameof(EffectiveStartTime))]
public partial class ShiftRuleEntity : EntityTenant
{
    /// <summary>
    /// 规则名称
    /// </summary>
    [Column(StringLength = 100)]
    public string RuleName { get; set; }

    /// <summary>
    /// 规则类型
    /// </summary>
    [Column(StringLength = 50)]
    public string RuleType { get; set; }

    /// <summary>
    /// 规则描述
    /// </summary>
    [Column(StringLength = 500)]
    public string Description { get; set; }

    /// <summary>
    /// 是否启用
    /// </summary>
    public bool IsEnabled { get; set; } = true;

    /// <summary>
    /// 规则参数 (JSON格式)
    /// </summary>
    [Column(StringLength = 2000)]
    public string RuleParameters { get; set; }

    /// <summary>
    /// 默认优先级
    /// </summary>
    public int DefaultPriority { get; set; } = 1;

    /// <summary>
    /// 规则生效开始时间
    /// </summary>
    public DateTime? EffectiveStartTime { get; set; }

    /// <summary>
    /// 规则生效结束时间
    /// </summary>
    public DateTime? EffectiveEndTime { get; set; }

    /// <summary>
    /// 规则版本号
    /// </summary>
    [Column(StringLength = 20)]
    public string Version { get; set; } = "1.0";

    /// <summary>
    /// 规则映射集合
    /// </summary>
    [Navigate(nameof(ShiftRuleMappingEntity.RuleId))]
    public virtual List<ShiftRuleMappingEntity> ShiftRuleMappings { get; set; }
} 