using e_suite.API.Common.models;
using e_suite.Database.Audit;
using e_suite.Database.Core.Tables.UserManager;
using e_suite.Utilities.Pagination;
using eSuite.Core.Miscellaneous;
using eSuite.Core.Security;

namespace e_suite.API.Common;

public interface IRoleManager
{
    Task<IPaginatedData<ReadRole>> GetRoles(Paging paging, IGeneralIdRef domain, CancellationToken cancellationToken);

    Task<ReadRole> GetRole(IGeneralIdRef generalIdRef, CancellationToken cancellationToken);

    Task CreateRole(AuditUserDetails auditUserDetails, CreateRole sequence, CancellationToken cancellationToken);
    Task DeleteRole(AuditUserDetails auditUserDetails, IGeneralIdRef generalIdRef, CancellationToken cancellationToken);
    Task EditRole(AuditUserDetails auditUserDetails, EditRole editSequence, CancellationToken cancellationToken);
    Task<IPaginatedData<RoleUser>> GetRoleUsers(Paging paging, GeneralIdRef roleId, CancellationToken cancellationToken);
    Task AddRoleUser(AuditUserDetails auditUserDetails, UserRoleIds userRole, CancellationToken cancellationToken);
    Task DeleteRoleUser(AuditUserDetails auditUserDetails, UserRoleIds userRole, CancellationToken cancellationToken);
    Task<IPaginatedData<GetSecurityAccess>>GetAccessList(Paging paging, CancellationToken cancellationToken);
    Task<IPaginatedData<GetRoleSecurityAccess>> GetRoleAccess(Paging paging, CancellationToken cancellationToken);
    Task AddRoleSecurityAccess(AuditUserDetails auditUserDetails, AddRoleSecurityAccess accessToAdd, CancellationToken cancellationToken);
    Task DeleteRoleSecurityAccess(AuditUserDetails auditUserDetails, DeleteRoleSecurityAccess accessToRemove, CancellationToken cancellationToken);
    Task<bool> HasAnyAccess(long? userId, SecurityAccess accessKey);
    Task CheckHasDomainAccess(long userId, IGeneralIdRef? specificDomain, SecurityAccess accessKey, CancellationToken cancellationToken);
    IEnumerable<GetSecurityAccess> GetMyUserAccess(User user);
}