using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NPP.SmartSchedue.Api.Contracts.Domain.Time;
using ZhonTai.Admin.Core.Repositories;

namespace NPP.SmartSchedue.Api.Contracts;

/// <summary>
/// 班次规则关联仓储接口
/// </summary>
public interface IShiftRuleMappingRepository : IRepositoryBase<ShiftRuleMappingEntity>
{
    /// <summary>
    /// 根据班次ID获取有效的班次规则列表
    /// 深度业务思考：通过映射表关联，获取班次对应的所有有效规则
    /// </summary>
    /// <param name="shiftId">班次ID</param>
    /// <param name="targetDate">目标日期（用于生效时间判断）</param>
    /// <returns>有效的班次规则列表</returns>
    Task<List<ShiftRuleEntity>> GetEffectiveShiftRulesAsync(long shiftId, DateTime? targetDate = null);

    /// <summary>
    /// 批量获取多个班次的规则映射
    /// 深度业务思考：批量查询优化，避免N+1查询问题
    /// </summary>
    /// <param name="shiftIds">班次ID列表</param>
    /// <param name="targetDate">目标日期（用于生效时间判断）</param>
    /// <returns>班次ID到规则列表的映射</returns>
    Task<Dictionary<long, List<ShiftRuleEntity>>> GetBatchShiftRulesAsync(List<long> shiftIds, DateTime? targetDate = null);
} 