using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ZhonTai.Admin.Core.Repositories;

namespace NPP.SmartSchedue.Api.Contracts.Domain.Notification;

/// <summary>
/// 通知设置仓储接口
/// </summary>
public interface INotificationSettingRepository : IRepositoryBase<NotificationSettingEntity>
{
    /// <summary>
    /// 根据启用状态获取通知设置列表
    /// </summary>
    Task<List<NotificationSettingEntity>> GetByEnabledAsync(bool enabled);

    /// <summary>
    /// 根据人员组ID获取通知设置列表
    /// </summary>
    Task<List<NotificationSettingEntity>> GetByPersonnelGroupIdAsync(long personnelGroupId);

    /// <summary>
    /// 根据通知方式获取通知设置列表
    /// </summary>
    Task<List<NotificationSettingEntity>> GetByNotificationTypeAsync(int notificationType);

    /// <summary>
    /// 根据触发条件获取匹配的通知设置列表
    /// 这里实现一个简化的匹配逻辑，实际项目中可能需要更复杂的条件匹配引擎
    /// </summary>
    Task<List<NotificationSettingEntity>> GetMatchingNotificationSettingsAsync(
        string businessType, 
        Dictionary<string, object> businessContext);

    /// <summary>
    /// 检查通知设置名称是否存在
    /// </summary>
    Task<bool> ExistsNotificationNameAsync(string notificationName, long? excludeId = null);

    /// <summary>
    /// 获取需要在当前时间执行的通知设置列表
    /// 根据决策点2：简单时间段，只支持开始时间-结束时间
    /// </summary>
    Task<List<NotificationSettingEntity>> GetActiveNotificationSettingsForTimeAsync(DateTime currentTime);
}