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

namespace SolarPower.Repository.Interface
{
    public interface ICompanyRepository : IRepositoryBase<Company>
    {

        /// <summary>
        /// 取得當前使用者所在的公司資訊
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        MyCompany GetMyCompanyInfoById(int id);

        /// <summary>
        /// 修改公司資料
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        Task UpdateCompany(UpdateCompany entity, List<string> properties);

        /// <summary>
        /// 取得下拉式公司選單，須為Deleted: 0、Status: 1
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        Task<List<CompanySelectItemList>> GetCompanySelectOptionListAsync(int companyId);

        /// <summary>
        /// 透過搜尋條件，查詢過濾後的公司
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        Task<List<CompanyDataTable>> GetAllByFilterAsync(PostCompanyFilter filter);

        /// <summary>
        /// 透過公司Id，查詢該公司底下狀態為正常的使用者
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        Task<int> GetNormalUserNumberByCompanyIdAsync(int id);

        /// <summary>
        /// 取得單一公司資料
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<Company> GetOneCompany(int id);

        /// <summary>
        /// 透過統編，取得單一公司基本資料
        /// </summary>
        /// <param name="taxIDNumber"></param>
        /// <returns></returns>
        Task<SimpleCompany> GetOneNormalSimpleCompanyByTaxIDNumber(string taxIDNumber);

        /// <summary>
        /// 透過公司編號，取得該公司的註冊人數
        /// </summary>
        /// <param name="companyId"></param>
        /// <returns></returns>
        Task<int> GetRegisterNumberByCompanyId(int companyId);

        /// <summary>
        /// 透過公司編號，取得該公司的權限池
        /// </summary>
        /// <param name="companyId"></param>
        /// <returns></returns>
        Task<List<CompanyAuthDataTable>> GetCompanyAuthByCompanyId(int companyId);

        /// <summary>
        /// 實際刪除公司權限池
        /// </summary>
        /// <param name="companyId"></param>
        /// <returns></returns>
        Task PurgeCompanyAuth(List<CompanyAuth> companyAuths);

        /// <summary>
        /// 實際刪除公司角色擁有的權限
        /// </summary>
        /// <param name="companyAuths"></param>
        /// <returns></returns>
        Task PurgeCompanyRoleAuth(int companyId, List<CompanyAuth> companyAuths);

        /// <summary>
        /// 新增公司權限池
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        Task<int> AddCompanyAuthAsync(List<CompanyAuth> entity, List<string> properties);

        /// <summary>
        /// 創建公司自己的DB
        /// </summary>
        /// <param name="dbName"></param>
        /// <returns></returns>
        Task CreatCompanyDB(string dbName);
    }
}
