using System.Security.Claims;
namespace ZB.MOM.WW.MxGateway.Server.Dashboard;
public interface IDashboardApiKeyManagementService
{
/// Determines whether the user can manage API keys.
/// The user principal.
/// True if the user can manage keys; otherwise false.
bool CanManage(ClaimsPrincipal user);
/// Creates a new API key.
/// The user principal.
/// The key creation request details.
/// Cancellation token.
/// The creation result.
Task CreateAsync(
ClaimsPrincipal user,
DashboardApiKeyManagementRequest request,
CancellationToken cancellationToken);
/// Revokes an existing API key.
/// The user principal.
/// The key identifier to revoke.
/// Cancellation token.
/// The revocation result.
Task RevokeAsync(
ClaimsPrincipal user,
string keyId,
CancellationToken cancellationToken);
/// Rotates an existing API key.
/// The user principal.
/// The key identifier to rotate.
/// Cancellation token.
/// The rotation result.
Task RotateAsync(
ClaimsPrincipal user,
string keyId,
CancellationToken cancellationToken);
/// Deletes an API key.
/// The user principal.
/// The key identifier to delete.
/// Cancellation token.
/// The deletion result.
Task DeleteAsync(
ClaimsPrincipal user,
string keyId,
CancellationToken cancellationToken);
}