namespace ZB.MOM.WW.MxGateway.Server.Dashboard;

public sealed record DashboardApiKeyManagementResult(
    bool Succeeded,
    string Message,
    string? ApiKey)
{
    /// <summary>Creates a successful result with an optional API key.</summary>
    /// <param name="message">The success message.</param>
    /// <param name="apiKey">The API key if generated or modified.</param>
    /// <returns>A successful result record.</returns>
    public static DashboardApiKeyManagementResult Success(string message, string? apiKey = null)
    {
        return new DashboardApiKeyManagementResult(true, message, apiKey);
    }

    /// <summary>Creates a failed result with an error message.</summary>
    /// <param name="message">The error message.</param>
    /// <returns>A failed result record.</returns>
    public static DashboardApiKeyManagementResult Fail(string message)
    {
        return new DashboardApiKeyManagementResult(false, message, null);
    }
}
