using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hotline.Share.Dtos.Org;

namespace Hotline.Settings
{
    public interface ISystemDomainService
    {
        /// <summary>
        /// 查询当前已有数据的部门等级参数
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<IEnumerable<KeyValuePair<int, string>>> QueryOrgLevelOptionsAsync(CancellationToken cancellationToken);
        Task<IEnumerable<KeyValuePair<string, string>>> QueryOrgLevelStringOptionsAsync(CancellationToken cancellationToken);

        Task<IReadOnlyList<SystemDicData>> GetSysDicDataByCodeAsync(string code, CancellationToken cancellationToken = default);

        /// <summary>
        /// 生成新的部门编码
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<string> GenerateNewOrgCodeAsync(string? parentId, CancellationToken cancellationToken);

        /// <summary>
        /// 部门名称是否重复
        /// </summary>
        /// <param name="orgname"></param>
        /// <returns></returns>
        Task<int> IsNameRepeat(string orgname,CancellationToken cancellationToken);

        /// <summary>
        /// 部门简称是否重复
        /// </summary>
        /// <param name="orgShrotName"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<int> IsShrotNameRepeat(string orgShrotName, CancellationToken cancellationToken);

        /// <summary>
        /// 新增部门
        /// </summary>
        Task AddOrgAsync(AddOrgDto dto, CancellationToken cancellationToken);
    }
}
