using ASHermed.SinoInterface.Api.ContractModel.App.Entity;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace ASHermed.SinoInterface.Api.IRepository.App
{
    public interface IPubAuthorizationRepository
    {
        List<Pub_Authorization_Detail> GetAuthorizationDetail();
        List<Pub_AuthorizationDto> GetPubAuthorizationList(int patId);
        int InsertAuthorization(Pub_AuthorizationDto model);
        Pub_AuthorizationDto GetAuthorization(int userid, int patId);
        Pub_AuthorizationDto GetUserAuthorizationByPat(int userid, int patId);
        Pub_AuthorizationDto GetUserAuthorizationByPatStatus(int userid, int patId);
        int RemoveUserAuthorization(int userid, int patId);

        /// <summary>
        /// 删除就诊人之后，所有的授权记录改为已删除
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="patId"></param>
        /// <returns></returns>
        Task<int> RemoveUserAuthorizationAsync(int userId, int patId);

        /// <summary>
        /// 删除”本人“的授权
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="patId"></param>
        /// <returns></returns> 
        Task<int> RemoveOneSelfAuthorizationAsync(int userId, int patId);

        Pub_AuthorizationDto GetAuthorizationForId(int id);
        Pub_AuthorizationDto GetAllAuthorizationForId(int id);
        int UpdateAuthorization(int id, int status, DateTime authorizationTime, string examineDetailIds, DateTime authorizationValidity, bool isForever, string authorizationPdf, string authorizationImg);
        int UpdateAuthorizationStatus(int id, int status);
        int InvalidAuthorization(int userid, int patid);
        List<Pub_AuthorizationDto>  GetUserAuthorization(int userId);
        List<Pub_AuthorizationDto> GetAuthorizationUserPat(int patid);

        List<Pub_AuthorizationDto> GetUserAuthorizationsByPats(int userId, List<int> patIds);
        Task<List<Pub_AuthorizationDto>> GetUserAuthorizationsByPatsAsync(int userId, List<int> patIds);
        List<Pub_AuthorizationDto> GetUserAuthorizationsByPats(List<int> userId, int patId);
        bool RelieveAuthorization(int id);
        List<Pub_AuthorizationDto> GetAllAuthorizationExpired();
        bool UpdateStatus(List<int> id, int status);
        (int, int) GetUserIdPatIdByAuthorizationId(int id);
    } 
}
