using SolarPower.Models;
using SolarPower.Models.Role;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SolarPower.Repository.Interface
{
    public interface IRoleRepository : IRepositoryBase<Role>
    {
        /// <summary>
        /// 取得當前使用者的角色資訊
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        MyRole GetMyRoleInfoById(int id);

        /// <summary>
        /// 取得下拉式公司角色選單，須為Deleted: 0
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        Task<List<RoleSelectItemList>> GetRoleSelectOptionListAsync(int companyId);

        /// <summary>
        /// 取得單一公司角色，須為Deleted: 0
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<Role> GetOneRoleAsync(int id);

        /// <summary>
        /// 透過搜尋條件，查詢過濾後的角色
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        Task<List<RoleDateTable>> GetAllByFilterAsync(PostRoleFilter filter);

        /// <summary>
        /// 更新公司角色名稱
        /// </summary>
        /// <param name="update"></param>
        /// <returns></returns>
        Task UpdateRoleAsync(UpdateRole update, List<string> properties);

        /// <summary>
        /// 透過角色編號，取得所有權限功能
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        Task<List<RoleAuthDataTable>> GetAllAuthByRoleIdAsync(int roleId);

        /// <summary>
        /// 透過公司編號，取得被賦予的權限池
        /// </summary>
        /// <param name="companyId"></param>
        /// <returns></returns>
        Task<List<CompanyAuthPage>> GetAllCompanyAuthPageAsync(int companyId);

        /// <summary>
        /// 查詢公司權限池裡面該角色尚未擁有的權限
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        Task<List<AuthPage>> GetRoleNotAuthPageAsync(PostRoleAuthFilter post);

        /// <summary>
        /// 新增角色權限
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        Task<int> AddRoleAuthAsync(List<RoleAuth> entity, List<string> properties);

        /// <summary>
        /// 實際刪除角色權限
        /// </summary>
        /// <returns></returns>
        Task PurgeOneRoleAuthAsync(int roleId, string authCode);
    }
}
