namespace Ablera.Serdica.Authority.Plugins.Base.Models;

/// <summary>
/// Generic result wrapper for write operations that need more detail than a boolean.
/// </summary>
public sealed class OperationResult
{
    private OperationResult(bool succeeded, string? errorCode)
    {
        Succeeded = succeeded;
        ErrorCode = errorCode;
    }

    public bool Succeeded { get; }
    public string? ErrorCode { get; }

    public static OperationResult Success() => new OperationResult(true, null);
    public static OperationResult Fail(string errorCode) => new OperationResult(false, errorCode);
}
