using ColaFlow.Modules.Mcp.Application.DTOs;

namespace ColaFlow.Modules.Mcp.Application.Services;

/// <summary>
/// Service interface for MCP API Key management
/// </summary>
public interface IMcpApiKeyService
{
    /// <summary>
    /// Create a new API Key
    /// </summary>
    Task<CreateApiKeyResponse> CreateAsync(CreateApiKeyRequest request, CancellationToken cancellationToken = default);

    /// <summary>
    /// Validate an API Key
    /// </summary>
    Task<ApiKeyValidationResult> ValidateAsync(string plainKey, string? ipAddress = null, CancellationToken cancellationToken = default);

    /// <summary>
    /// Get API Key by ID
    /// </summary>
    Task<ApiKeyResponse?> GetByIdAsync(Guid id, Guid tenantId, CancellationToken cancellationToken = default);

    /// <summary>
    /// Get all API Keys for a tenant
    /// </summary>
    Task<List<ApiKeyResponse>> GetByTenantIdAsync(Guid tenantId, CancellationToken cancellationToken = default);

    /// <summary>
    /// Get all API Keys for a user
    /// </summary>
    Task<List<ApiKeyResponse>> GetByUserIdAsync(Guid userId, Guid tenantId, CancellationToken cancellationToken = default);

    /// <summary>
    /// Update API Key metadata
    /// </summary>
    Task<ApiKeyResponse> UpdateMetadataAsync(Guid id, Guid tenantId, UpdateApiKeyMetadataRequest request, CancellationToken cancellationToken = default);

    /// <summary>
    /// Update API Key permissions
    /// </summary>
    Task<ApiKeyResponse> UpdatePermissionsAsync(Guid id, Guid tenantId, UpdateApiKeyPermissionsRequest request, CancellationToken cancellationToken = default);

    /// <summary>
    /// Revoke an API Key
    /// </summary>
    Task RevokeAsync(Guid id, Guid tenantId, Guid revokedBy, CancellationToken cancellationToken = default);
}
