using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NPP.SmartSchedue.Api.Contracts.Services.Equipment.Dto;

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

/// <summary>
/// 设备统计分析服务接口
/// 提供按设备类型的统计分析功能，独立于设备分配业务逻辑
/// </summary>
public interface IEquipmentStatisticsService
{
    /// <summary>
    /// 按设备类型统计设备数量和状态分布
    /// 深度业务场景：支持生产规划时了解各类型设备资源配置情况
    /// </summary>
    /// <param name="startDate">统计开始日期</param>
    /// <param name="endDate">统计结束日期</param>
    /// <param name="includeInactive">是否包含非活跃设备（报废、停用等）</param>
    /// <returns>按设备类型分组的统计结果</returns>
    Task<List<EquipmentTypeStatisticsOutput>> GetEquipmentStatisticsByTypeAsync(
        DateTime? startDate = null, 
        DateTime? endDate = null, 
        bool includeInactive = false);

    /// <summary>
    /// 按设备类型统计使用率和工作负荷
    /// 深度业务场景：支持设备使用效率分析和设备采购决策
    /// </summary>
    /// <param name="startDate">统计开始日期</param>
    /// <param name="endDate">统计结束日期</param>
    /// <returns>设备类型使用率统计</returns>
    Task<List<EquipmentTypeUsageOutput>> GetEquipmentUsageByTypeAsync(
        DateTime startDate, 
        DateTime endDate);

    /// <summary>
    /// 按设备类型统计任务分配情况
    /// 深度业务场景：支持工艺流程分析和设备负荷均衡评估
    /// </summary>
    /// <param name="startDate">统计开始日期</param>
    /// <param name="endDate">统计结束日期</param>
    /// <param name="includeCompletedTasks">是否包含已完成任务</param>
    /// <returns>设备类型任务分配统计</returns>
    Task<List<EquipmentTypeTaskAllocationOutput>> GetTaskAllocationByTypeAsync(
        DateTime startDate, 
        DateTime endDate, 
        bool includeCompletedTasks = true);

    /// <summary>
    /// 获取设备类型趋势分析数据
    /// 深度业务场景：支持长期设备投资规划和维护策略制定
    /// </summary>
    /// <param name="equipmentType">指定设备类型，null则返回所有类型</param>
    /// <param name="startDate">分析开始日期</param>
    /// <param name="endDate">分析结束日期</param>
    /// <param name="groupByPeriod">分组周期：Day, Week, Month</param>
    /// <returns>设备类型趋势数据</returns>
    Task<List<EquipmentTypeTrendOutput>> GetEquipmentTypeTrendAsync(
        string? equipmentType, 
        DateTime startDate, 
        DateTime endDate, 
        string groupByPeriod = "Day");
}