namespace Media.JoshHeaps.Net.Models;
public enum BreadboardOutcome
{
Success,
NotFound,
Invalid,
Failed
}
///
/// Outcome of a write against a breadboard project. The API layer maps the outcome to a
/// status code; every rule that produces lives in
/// the service (or the validator it delegates to), never in the controller.
///
public sealed record BreadboardResult(
BreadboardOutcome Outcome,
IReadOnlyList Errors,
BreadboardProject? Project)
{
/// The single wording for "gone or never yours" — read and write paths share it.
public const string NotFoundMessage = "Project not found";
public static BreadboardResult Succeeded(BreadboardProject? project = null) =>
new(BreadboardOutcome.Success, [], project);
public static BreadboardResult Missing() =>
new(BreadboardOutcome.NotFound, [NotFoundMessage], null);
public static BreadboardResult Invalid(IReadOnlyList errors) =>
new(BreadboardOutcome.Invalid, errors, null);
public static BreadboardResult Failed(string error) =>
new(BreadboardOutcome.Failed, [error], null);
}