"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeIsEnumToSequelize = exports.TypeIsEnumToSwagger = void 0;
const sequelize_1 = require("sequelize");
const toSequelizeGenerator_1 = require("./generators/toSequelizeGenerator");
const toSwaggerGenerator_1 = require("./generators/toSwaggerGenerator");
const typeGenerator_1 = require("./generators/typeGenerator");
exports.TypeIsEnumToSwagger = (0, toSwaggerGenerator_1.toSwaggerGenerator)((options) => ({
    type: 'string',
    enum: options === null || options === void 0 ? void 0 : options.values,
    description: options === null || options === void 0 ? void 0 : options.comment,
}));
exports.TypeIsEnumToSequelize = (0, toSequelizeGenerator_1.toSequelizeGenerator)((options) => (Object.assign(Object.assign({}, options), { type: sequelize_1.DataTypes.ENUM({ values: options.values }), comment: options === null || options === void 0 ? void 0 : options.comment })));
const TypeIsEnum = (0, typeGenerator_1.typeGenerator)((options) => ({
    __name: 'enum',
    toSwagger: () => (0, exports.TypeIsEnumToSwagger)(options),
    toSequelize: () => (0, exports.TypeIsEnumToSequelize)(options),
    fixValue: (o) => {
        var _a, _b;
        if (o === undefined || o === null)
            return o;
        return ((_b = (_a = options === null || options === void 0 ? void 0 : options.values) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, String(o))) ? String(o) : undefined;
    },
}));
exports.default = TypeIsEnum;
//# sourceMappingURL=enum.js.map