100 lines
4.8 KiB
C#
100 lines
4.8 KiB
C#
// ***********************************************************************
|
|
// <copyright file="IRoleService.cs">
|
|
// AgileWebs
|
|
// </copyright>
|
|
// ***********************************************************************
|
|
|
|
using Core.Thalos.BuildingBlocks;
|
|
using Core.Thalos.Domain.Contexts.Onboarding.Request;
|
|
|
|
namespace Core.Thalos.Provider.Contracts
|
|
{
|
|
/// <summary>
|
|
/// Interface for Role-related service operations.
|
|
/// </summary>
|
|
public interface IRoleProvider
|
|
{
|
|
/// <summary>
|
|
/// Creates a new Role.
|
|
/// </summary>
|
|
/// <param name="newRole">The Role to be created.</param>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
|
/// </returns>
|
|
ValueTask<RoleAdapter> CreateRole(RoleRequest newRole, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Gets a Role by its identifier.
|
|
/// </summary>
|
|
/// <param name="_id">The Role Mongo identifier.</param>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
|
/// </returns>
|
|
ValueTask<RoleAdapter> GetRoleById(string _id, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Gets all Roles.
|
|
/// </summary>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{IEnumerable{RoleAdapter}}"/> representing the asynchronous execution of the service.
|
|
/// </returns>
|
|
ValueTask<IEnumerable<RoleAdapter>> GetAllRoles(CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Changes the status of a Role.
|
|
/// </summary>
|
|
/// <param name="_id">The Role Mongo identifier.</param>
|
|
/// <param name="newStatus">The new status of the Role.</param>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
|
/// </returns>
|
|
ValueTask<RoleAdapter?> ChangeRoleStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Updates a Role.
|
|
/// </summary>
|
|
/// <param name="entity">The Role to be updated.</param>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
|
/// </returns>
|
|
ValueTask<RoleAdapter?> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Adds an application to the Role's list of applications.
|
|
/// </summary>
|
|
/// <param name="roleId">The identifier of the Role to which the application will be added.</param>
|
|
/// <param name="application">The application enum value to add.</param>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous operation with the updated Role.
|
|
/// </returns>
|
|
ValueTask<RoleAdapter> AddApplicationToRole(string roleId, ApplicationsEnum application, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Removes an application from the Role's list of applications.
|
|
/// </summary>
|
|
/// <param name="roleId">The identifier of the Role from which the application will be removed.</param>
|
|
/// <param name="application">The application enum value to remove.</param>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous operation with the updated Role.
|
|
/// </returns>
|
|
ValueTask<RoleAdapter> RemoveApplicationFromRole(string roleId, ApplicationsEnum application, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Deletes a Role by its identifier.
|
|
/// </summary>
|
|
/// <param name="_id">The Role Mongo identifier.</param>
|
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
|
/// <returns>
|
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
|
/// </returns>
|
|
ValueTask<RoleAdapter?> DeleteRole(string _id, CancellationToken cancellationToken);
|
|
}
|
|
}
|