"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InjectLocale = void 0;
const common_1 = require("@nestjs/common");
const class_transformer_1 = require("class-transformer");
exports.InjectLocale = (0, common_1.createParamDecorator)((data, ctx) => {
    const request = ctx.switchToHttp().getRequest();
    const body = request.body;
    const locale = request['locale'] || 'en';
    // Inject locale into the body object
    if (body && typeof body === 'object') {
        body['_locale'] = locale;
    }
    return data ? (0, class_transformer_1.plainToClass)(data, body) : body;
});
//# sourceMappingURL=inject-locale.decorator.js.map