namespace Infrastructure.Sql;
///
/// Custom SQL Server error numbers (50000+) that a stored procedure could use to signal
/// domain-level failures via THROW, for a repository to catch as
/// and translate via ex.Number into
/// the corresponding Domain.Exceptions type.
///
///
/// Currently unused: the schema has no stored procedures, and no repository throws or catches on
/// these numbers. Repositories instead run their own existence/concurrency checks and throw
/// Domain.Exceptions directly (see docs/website/database.md for the current
/// approach). This type is kept in case a future stored procedure reintroduces the pattern; each
/// number would
/// identify a category of error shared by every procedure that raises it, not a single call site.
///
public static class SqlErrorCodes
{
///
/// A stored procedure's own input validation failed (e.g. a required parameter was NULL).
/// Maps to HTTP 400 Bad Request.
///
public const int Validation = 50400;
///
/// A stored procedure could not find a row it required, by primary key or foreign key. Maps to
/// HTTP 404 Not Found.
///
public const int NotFound = 50404;
///
/// A stored procedure detected a conflict: either a duplicate/already-exists row, or a stale
/// optimistic-concurrency token (row-version mismatch). Maps to HTTP 409 Conflict.
///
public const int Conflict = 50409;
///
/// A defensive check inside a stored procedure failed under conditions that should be
/// unreachable in normal operation (e.g. an INSERT that should always affect one row
/// affected zero). Left uncaught by repositories so it falls through to the generic
/// handler. Maps to HTTP 500/503.
///
public const int InternalFailure = 50500;
}