namespace Infrastructure.Sql;
///
/// Custom SQL Server error numbers (50000+) that this application's stored procedures use to
/// signal domain-level failures via THROW. Repositories catch
/// and switch on ex.Number against
/// these constants to translate the failure into the corresponding Domain.Exceptions type.
///
///
/// Each number is shared by every procedure that raises that category of error — it identifies
/// the category, not a single call site. The procedure's own error message (ex.Message)
/// already says which entity or rule was involved, so it is safe to surface directly to callers.
///
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;
}