using adas_core.Domain.Enums;
using adas_core.Domain.Models.AppSettings;
using adas_core.Domain.Models.MongoModels;
namespace adas_core.Application.Services.Interfaces;
public interface IPermissionService
{
///
/// Retrieves the set of display permission types applicable to the specified user for the given display.
///
/// The display for which permissions are being evaluated.
/// The user whose permissions for the display are being retrieved.
/// A task that represents the asynchronous operation, containing the granted to the user for the display.
public Task GetPermissionsForDisplay(Display display, User user);
///
/// Retrieves the display-friendly permission types applicable to the specified user for the given unit.
///
/// The identifier of the unit whose permissions are being queried.
/// The user whose permissions for the unit should be evaluated.
/// A task that represents the asynchronous operation, containing the for the specified unit and user.
public Task GetPermissionsForUnit(string unitId, User user);
///
/// Retrieves the panel permission types associated with the specified user.
///
/// The user whose panel permissions are being queried.
/// The granted to the specified user.
public PanelPermissionTypes GetPermissionsForPanel(User user);
///
/// Retrieves the panel permission types associated with the specified user.
///
/// The identifier or name of the user whose panel permissions are being requested.
/// A task that represents the asynchronous operation, containing the granted to the user.
public Task GetPermissionsForPanel(string user);
///
/// Asynchronously checks whether the specified user, with the given role and source permission, has access to the specified display.
///
/// The name of the user whose access is being verified.
/// The role assigned to the user, used to determine access rights.
/// The source permission type considered when evaluating access.
/// The identifier of the display for which access is being checked.
/// A task that represents the asynchronous operation. The task result is true if the user has access to the display; otherwise, false.
Task HasAccessToDisplay(string username, PermissionEnum.RolesType role,
PermissionEnum.SourcePermissionsEnum source, string displayId);
///
/// Asynchronously determines whether the specified user, with the given role and permission source, has access to the identified unit.
///
/// The identifier of the user whose access is being evaluated.
/// The role assigned to the user, used in the access evaluation.
/// The permission source used to resolve the user's access rights.
/// The identifier of the unit to check access against.
/// A task that resolves to true if the user has access to the specified unit; otherwise, false.
Task HasAccessToUnit(string username, PermissionEnum.RolesType role,
PermissionEnum.SourcePermissionsEnum source, string unitId);
///
/// Asynchronously determines whether the specified user has access to a panel based on their role and the requested source permission.
///
/// The identifier of the user whose panel access is being evaluated.
/// The role assigned to the user, used to resolve applicable permissions.
/// The source permission being checked against the user's access rights.
/// A task that resolves to true if the user has access to the panel; otherwise, false.
Task HasAccessToPanel(string username, PermissionEnum.RolesType role,
PermissionEnum.SourcePermissionsEnum source);
}