"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.GenerateTitleArgsDto = void 0;
const class_validator_1 = require("class-validator");
function Is3To5Words(validationOptions) {
    return function (target, propertyName) {
        (0, class_validator_1.registerDecorator)({
            name: 'is3To5Words',
            target: target.constructor,
            propertyName: propertyName,
            options: validationOptions,
            validator: {
                validate(value, _args) {
                    if (typeof value !== 'string')
                        return false;
                    const words = value.trim().split(/\s+/).filter(Boolean);
                    return words.length >= 3 && words.length <= 5;
                },
                defaultMessage(_args) {
                    return 'Title must be between 3 and 5 words.';
                },
            },
        });
    };
}
class GenerateTitleArgsDto {
}
exports.GenerateTitleArgsDto = GenerateTitleArgsDto;
__decorate([
    (0, class_validator_1.IsString)({ message: 'title must be a string.' }),
    (0, class_validator_1.IsNotEmpty)({ message: 'title must not be empty.' }),
    Is3To5Words({ message: 'Title must be between 3 and 5 words.' }),
    __metadata("design:type", String)
], GenerateTitleArgsDto.prototype, "title", void 0);
//# sourceMappingURL=generate-title.args.dto.js.map