using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using ZhonTai.Admin.Core.Dto;
using NPP.SmartSchedue.Api.Contracts.Services.Work.Input;
using NPP.SmartSchedue.Api.Contracts.Services.Work.Output;
using NPP.SmartSchedue.Api.Contracts.Core.Enums;
using NPP.SmartSchedue.Api.Contracts.Domain.Work;

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

/// <summary>
/// 工作任务服务接口
/// </summary>
public interface IWorkOrderService
{
    /// <summary>
    /// 查询
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<WorkOrderGetOutput> GetAsync(long id);

    /// <summary>
    /// 查询分页
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<PageOutput<WorkOrderGetPageOutput>> GetPageAsync(PageInput<WorkOrderGetPageInput> input);

    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<long> AddAsync(WorkOrderAddInput input);

    /// <summary>
    /// 批量添加
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<BatchWorkOrderAddOutput> BatchAddAsync(BatchWorkOrderAddInput input);

    /// <summary>
    /// 修改
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task UpdateAsync(WorkOrderUpdateInput input);

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task DeleteAsync(long id);

    /// <summary>
    /// 软删除
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task SoftDeleteAsync(long id);

    /// <summary>
    /// 批量软删除
    /// </summary>
    /// <param name="ids"></param>
    /// <returns></returns>
    Task BatchSoftDeleteAsync(long[] ids);

    /// <summary>
    /// 更新任务状态
    /// </summary>
    /// <param name="id"></param>
    /// <param name="status"></param>
    /// <returns></returns>
    Task UpdateStatusAsync(long id, WorkOrderStatusEnum status);
    
    /// <summary>
    /// 开始任务
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task StartAsync(long id);

    /// <summary>
    /// 完成任务
    /// </summary>
    /// <param name="id"></param>
    /// <param name="actualWorkHours"></param>
    /// <returns></returns>
    Task CompleteAsync(long id, decimal? actualWorkHours = null);

    /// <summary>
    /// 单个任务自检
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<WorkOrderValidationOutput> ValidateWorkOrderAsync(SingleWorkOrderValidationInput input);

    /// <summary>
    /// 多个任务自检
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<MultipleWorkOrderValidationOutput> ValidateMultipleWorkOrdersAsync(WorkOrderValidationInput input);

    /// <summary>
    /// 根据用户ID查询任务列表
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns></returns>
    Task<List<WorkOrderGetOutput>> GetByUserIdAsync(long userId);

    /// <summary>
    /// 转换任务班次的任务时间
    /// </summary>
    /// <param name="workOrderEntity"></param>
    /// <returns></returns>
    Task<WorkOrderEntity> ConvertWorkOrderShift(WorkOrderEntity workOrderEntity);

    Task<Dictionary<long, int>> GetPendingSubmitCountByCreatorAsync();
} 