using System.Collections.Generic;
using System.Threading.Tasks;
using NPP.SmartSchedue.Api.Contracts.Services.Work.Input;
using NPP.SmartSchedue.Api.Contracts.Services.Work.Output;

namespace NPP.SmartSchedue.Api.Contracts.Services.Work;

/// <summary>
/// 工作任务分配修改服务接口
/// 专门用于智能排班结果的手动修改功能
/// </summary>
public interface IWorkOrderAssignmentService
{
    /// <summary>
    /// 更新任务人员分配
    /// </summary>
    /// <param name="input">人员分配更新输入</param>
    /// <returns>分配更新结果</returns>
    Task<WorkOrderAssignmentUpdateOutput> UpdatePersonnelAssignmentAsync(WorkOrderPersonnelUpdateInput input);

    /// <summary>
    /// 更新任务设备分配
    /// </summary>
    /// <param name="input">设备分配更新输入</param>
    /// <returns>分配更新结果</returns>
    Task<WorkOrderAssignmentUpdateOutput> UpdateEquipmentAssignmentAsync(WorkOrderEquipmentUpdateInput input);

    /// <summary>
    /// 批量更新任务分配（支持人员和设备同时修改）
    /// </summary>
    /// <param name="workOrderId">任务ID</param>
    /// <param name="personnelInput">人员分配输入（可为空）</param>
    /// <param name="equipmentInput">设备分配输入（可为空）</param>
    /// <returns>分配更新结果</returns>
    Task<WorkOrderAssignmentUpdateOutput> UpdateAssignmentAsync(
        long workOrderId, 
        WorkOrderPersonnelUpdateInput personnelInput = null, 
        WorkOrderEquipmentUpdateInput equipmentInput = null);

    /// <summary>
    /// 验证任务分配的合法性（不执行更新，仅验证）
    /// </summary>
    /// <param name="workOrderId">任务ID</param>
    /// <param name="personnelId">人员ID</param>
    /// <param name="equipmentId">设备ID</param>
    /// <param name="flPersonnelIds">FL人员ID列表</param>
    /// <returns>验证结果</returns>
    Task<WorkOrderAssignmentUpdateOutput> ValidateAssignmentAsync(
        long workOrderId, 
        long? personnelId = null, 
        long? equipmentId = null, 
        List<long> flPersonnelIds = null);

    /// <summary>
    /// 批量验证多个任务的分配修改
    /// </summary>
    /// <param name="assignmentRequests">分配修改请求列表</param>
    /// <returns>批量验证结果</returns>
    Task<BatchWorkOrderAssignmentUpdateOutput> ValidateBatchAssignmentAsync(
        List<WorkOrderAssignmentRequest> assignmentRequests);

    /// <summary>
    /// 获取任务的可用人员列表（基于资质和时间约束）
    /// </summary>
    /// <param name="workOrderId">任务ID</param>
    /// <returns>可用人员列表</returns>
    Task<AvailablePersonnelOutput> GetAvailablePersonnelAsync(long workOrderId);

    /// <summary>
    /// 获取任务的可用设备列表（基于设备类型和时间约束）
    /// </summary>
    /// <param name="workOrderId">任务ID</param>
    /// <returns>可用设备列表</returns>
    Task<AvailableEquipmentOutput> GetAvailableEquipmentAsync(long workOrderId);
}