using ColaFlow.Modules.Mcp.Domain.ValueObjects;

namespace ColaFlow.Modules.Mcp.Application.DTOs;

/// <summary>
/// Result of API Key validation
/// </summary>
public class ApiKeyValidationResult
{
    public bool IsValid { get; private set; }
    public string? ErrorMessage { get; private set; }
    public Guid ApiKeyId { get; private set; }
    public Guid TenantId { get; private set; }
    public Guid UserId { get; private set; }
    public ApiKeyPermissions? Permissions { get; private set; }

    private ApiKeyValidationResult()
    {
    }

    public static ApiKeyValidationResult Valid(
        Guid apiKeyId,
        Guid tenantId,
        Guid userId,
        ApiKeyPermissions permissions)
    {
        return new ApiKeyValidationResult
        {
            IsValid = true,
            ApiKeyId = apiKeyId,
            TenantId = tenantId,
            UserId = userId,
            Permissions = permissions
        };
    }

    public static ApiKeyValidationResult Invalid(string errorMessage)
    {
        return new ApiKeyValidationResult
        {
            IsValid = false,
            ErrorMessage = errorMessage
        };
    }
}
