using System;
using System.Collections.Generic;
using NPP.SmartSchedue.Api.Contracts.Domain.Personnel;
using NPP.SmartSchedue.Api.Contracts.Domain.Work;
using NPP.SmartSchedue.Api.Contracts.Services.Integration.Input;
using NPP.SmartSchedue.Api.Contracts.Services.Integration.Output;

namespace NPP.SmartSchedue.Api.Contracts.Services.Integration.Models;

public class AllocationContext
{
    public AllocationContext()
    {
        // 初始化所有集合属性，避免空引用异常
        WorkOrders = new List<WorkOrderEntity>();
        WeightConfiguration = new Dictionary<string, double>();
        AvailablePersonnel = new List<PersonnelEntity>();
        ProcessingLog = new List<string>();
        Errors = new List<string>();
        ConstraintResults = new Dictionary<long, List<ConstraintEvaluationResult>>();
        FilteredCandidates = new Dictionary<long, List<PersonnelCandidate>>();
        Metrics = new Dictionary<string, object>();
        OptimizationResults = new Dictionary<long, List<OptimizationScoreResult>>();
    }

    public string ContextId { get; set; }
    
    public DateTime CreatedAt { get; set; }
    
    public List<WorkOrderEntity> WorkOrders { get; set; }
    
    public PersonnelAllocationStrategy  Strategy { get; set; }
    
    public  Dictionary<string, double>  WeightConfiguration  { get; set; }
        
    public List<PersonnelEntity>  AvailablePersonnel { get; set; }

    public List<string> ProcessingLog { get; set; }
    
    public List<string> Errors { get; set; }

    public Dictionary<long, List<ConstraintEvaluationResult>> ConstraintResults { get; set; }

    public Dictionary<long, List<PersonnelCandidate>>  FilteredCandidates   { get; set; }

    /// <summary>
    /// 性能指标字典
    /// 存储分配过程中各阶段的性能数据，如执行时间、处理数量等
    /// Key: 指标名称，Value: 指标值
    /// </summary>
    public Dictionary<string, object> Metrics { get; set; }
    
    /// <summary>
    /// 优化决策结果字典
    /// 存储每个工作任务的优化决策详细结果
    /// Key: 工作任务ID, Value: 优化评分结果列表
    /// </summary>
    public Dictionary<long, List<OptimizationScoreResult>> OptimizationResults { get; set; }

}