"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiAuthErrors = exports.ApiStandardErrors = exports.ApiTooManyRequests = exports.ApiConflictError = exports.ApiNotFoundError = exports.ApiForbidden = exports.ApiUnauthorized = exports.ApiValidationError = exports.ApiErrorResponseDto = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
class ApiErrorResponseDto {
    statusCode;
    error;
    message;
    code;
}
exports.ApiErrorResponseDto = ApiErrorResponseDto;
__decorate([
    (0, swagger_1.ApiProperty)({ example: 401, description: 'HTTP status code' }),
    __metadata("design:type", Number)
], ApiErrorResponseDto.prototype, "statusCode", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ example: 'Unauthorized', description: 'HTTP status text / exception name' }),
    __metadata("design:type", String)
], ApiErrorResponseDto.prototype, "error", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ example: 'Invalid credentials', description: 'Human-readable message' }),
    __metadata("design:type", String)
], ApiErrorResponseDto.prototype, "message", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        example: 'INVALID_CREDENTIALS',
        description: 'Stable, machine-readable error code — branch on this, not the message',
    }),
    __metadata("design:type", String)
], ApiErrorResponseDto.prototype, "code", void 0);
const ApiValidationError = (description = 'Validation failed (bad input).') => (0, swagger_1.ApiResponse)({ status: 400, description, type: ApiErrorResponseDto });
exports.ApiValidationError = ApiValidationError;
const ApiUnauthorized = (description = 'Missing, invalid, or expired authentication.') => (0, swagger_1.ApiResponse)({ status: 401, description, type: ApiErrorResponseDto });
exports.ApiUnauthorized = ApiUnauthorized;
const ApiForbidden = (description = 'Authenticated but not permitted.') => (0, swagger_1.ApiResponse)({ status: 403, description, type: ApiErrorResponseDto });
exports.ApiForbidden = ApiForbidden;
const ApiNotFoundError = (description = 'Resource not found.') => (0, swagger_1.ApiResponse)({ status: 404, description, type: ApiErrorResponseDto });
exports.ApiNotFoundError = ApiNotFoundError;
const ApiConflictError = (description = 'Conflict — resource already exists.') => (0, swagger_1.ApiResponse)({ status: 409, description, type: ApiErrorResponseDto });
exports.ApiConflictError = ApiConflictError;
const ApiTooManyRequests = (description = 'Too many attempts — rate limited / locked out.') => (0, swagger_1.ApiResponse)({ status: 429, description, type: ApiErrorResponseDto });
exports.ApiTooManyRequests = ApiTooManyRequests;
const ApiStandardErrors = () => (0, common_1.applyDecorators)((0, exports.ApiValidationError)(), (0, exports.ApiUnauthorized)());
exports.ApiStandardErrors = ApiStandardErrors;
const ApiAuthErrors = () => (0, common_1.applyDecorators)((0, exports.ApiUnauthorized)(), (0, exports.ApiForbidden)());
exports.ApiAuthErrors = ApiAuthErrors;
//# sourceMappingURL=api-responses.decorator.js.map