using OpenWarehouse.auth.lib.Model.Service;

namespace OpenWarehouse.auth.api.Common.PrivilageManager;

public interface IPrivilageManager
{
    
    public Task<List<string?>> GetUserPrivilage(ApplicationUser user);
    public Task<List<string>?> GetRolePrivilage(ApplicationRole role);
    
    public Task AddRolePrivilage(ApplicationRole role, string privilage);
    public Task DeleteRolePrivilage(ApplicationRole role, string privilage);
    
    public Task<bool> RoleHasPrivilage(ApplicationRole role, string privilage);
    public Task<bool> UserHasPrivilage(ApplicationUser user, string privilage);
    public Task<bool> UserHasGlobalPrivilage(ApplicationUser user, GlobalPrivilage.Privilege privilege);

    public Task<RolePrivilage?> GetPrivilageByNameIfDontExistCreateAsync(string privilage);

    public Task<RolePrivilage?> GetPrivilageByName(string privilage);

    public Task<CreateServiceRoleResult> CreatePrivageAsync(string privilage);
}