using System.Collections.Generic;

namespace NPP.SmartSchedue.Api.Services.Integration.Models
{
    /// <summary>
    /// 冲突类型枚举
    /// </summary>
    public enum ConflictType
    {
        /// <summary>
        /// 时间重叠冲突
        /// </summary>
        TimeOverlap = 1,

        /// <summary>
        /// 资质不匹配冲突
        /// </summary>
        QualificationMismatch = 2,

        /// <summary>
        /// 工作负载超限冲突
        /// </summary>
        WorkloadOverflow = 3,

        /// <summary>
        /// 人员不可用冲突
        /// </summary>
        PersonnelUnavailable = 4,

        /// <summary>
        /// 设备资源冲突
        /// </summary>
        EquipmentConflict = 5
    }

    /// <summary>
    /// 分配冲突信息
    /// </summary>
    public class AllocationConflict
    {
        /// <summary>
        /// 冲突类型
        /// </summary>
        public ConflictType ConflictType { get; set; }

        /// <summary>
        /// 受影响的任务ID列表
        /// </summary>
        public List<long> AffectedTaskIds { get; set; } = new List<long>();

        /// <summary>
        /// 受影响的人员ID
        /// </summary>
        public long? AffectedPersonnelId { get; set; }

        /// <summary>
        /// 冲突描述
        /// </summary>
        public string Description { get; set; } = "";

        /// <summary>
        /// 影响评分 (1-10, 10为最高)
        /// </summary>
        public int ImpactScore { get; set; }

        /// <summary>
        /// 冲突详细信息
        /// </summary>
        public List<string> ConflictDetails { get; set; } = new List<string>();
    }

    /// <summary>
    /// 分配冲突分析结果
    /// </summary>
    public class AllocationConflictAnalysis
    {
        /// <summary>
        /// 是否存在冲突
        /// </summary>
        public bool HasConflicts { get; set; }

        /// <summary>
        /// 冲突列表
        /// </summary>
        public List<AllocationConflict> Conflicts { get; set; } = new List<AllocationConflict>();

        /// <summary>
        /// 冲突总数
        /// </summary>
        public int TotalConflictCount { get; set; }

        /// <summary>
        /// 严重冲突数量
        /// </summary>
        public int CriticalConflictCount { get; set; }
    }

    /// <summary>
    /// 冲突解决结果
    /// </summary>
    public class ConflictResolutionResult
    {
        /// <summary>
        /// 是否已解决
        /// </summary>
        public bool IsResolved { get; set; }

        /// <summary>
        /// 调整方案列表
        /// </summary>
        public List<AllocationAdjustment> Adjustments { get; set; } = new List<AllocationAdjustment>();

        /// <summary>
        /// 解决方案描述
        /// </summary>
        public string ResolutionDescription { get; set; } = "";
    }

    /// <summary>
    /// 分配调整方案
    /// </summary>
    public class AllocationAdjustment
    {
        /// <summary>
        /// 任务ID
        /// </summary>
        public long TaskId { get; set; }

        /// <summary>
        /// 原人员ID
        /// </summary>
        public long? OldPersonnelId { get; set; }

        /// <summary>
        /// 新人员ID (null表示取消分配)
        /// </summary>
        public long? NewPersonnelId { get; set; }

        /// <summary>
        /// 调整原因
        /// </summary>
        public string AdjustmentReason { get; set; } = "";
    }
}