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

namespace NPP.SmartSchedue.Api.Contracts.Core.Repositories;

/// <summary>
/// 人员组仓储接口
/// </summary>
public interface IPersonnelGroupRepository : IRepositoryBase<PersonnelGroupEntity>
{
    /// <summary>
    /// 根据启用状态获取人员组列表
    /// </summary>
    /// <param name="enabled">是否启用</param>
    /// <returns></returns>
    Task<List<PersonnelGroupEntity>> GetByEnabledAsync(bool enabled);

    /// <summary>
    /// 根据人员组类型获取人员组列表
    /// </summary>
    /// <param name="groupType">人员组类型</param>
    /// <returns></returns>
    Task<List<PersonnelGroupEntity>> GetByGroupTypeAsync(PersonnelGroupTypeEnum groupType);

    /// <summary>
    /// 检查人员组名称是否存在
    /// </summary>
    /// <param name="groupName">人员组名称</param>
    /// <param name="excludeId">排除的ID</param>
    /// <returns></returns>
    Task<bool> ExistsGroupNameAsync(string groupName, long? excludeId = null);

    /// <summary>
    /// 获取包含指定人员的人员组列表
    /// </summary>
    /// <param name="personnelId">人员ID</param>
    /// <returns></returns>
    Task<List<PersonnelGroupEntity>> GetGroupsContainingPersonnelAsync(long personnelId);

    /// <summary>
    /// 获取包含指定部门的人员组列表
    /// </summary>
    /// <param name="departmentId">部门ID</param>
    /// <returns></returns>
    Task<List<PersonnelGroupEntity>> GetGroupsContainingDepartmentAsync(long departmentId);

    /// <summary>
    /// 获取包含指定职位的人员组列表
    /// </summary>
    /// <param name="position">职位</param>
    /// <returns></returns>
    Task<List<PersonnelGroupEntity>> GetGroupsContainingPositionAsync(string position);

    /// <summary>
    /// 计算人员组的实际人员数量
    /// </summary>
    /// <param name="personnelGroupId">人员组ID</param>
    /// <returns></returns>
    Task<int> CalculatePersonnelCountAsync(long personnelGroupId);
}