"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeIsIntFixValue = exports.TypeIsIntToSequelize = exports.TypeIsIntToSwagger = 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.TypeIsIntToSwagger = (0, toSwaggerGenerator_1.toSwaggerGenerator)((options) => ({
    type: 'integer',
    format: 'int32',
    description: options === null || options === void 0 ? void 0 : options.comment,
}));
exports.TypeIsIntToSequelize = (0, toSequelizeGenerator_1.toSequelizeGenerator)((options) => (Object.assign(Object.assign({}, options), { type: sequelize_1.DataTypes.INTEGER(options), comment: options === null || options === void 0 ? void 0 : options.comment })));
const TypeIsIntFixValue = (o) => {
    if (o === undefined || o === null)
        return o;
    return parseInt(String(o), 10);
};
exports.TypeIsIntFixValue = TypeIsIntFixValue;
const TypeIsInt = (0, typeGenerator_1.typeGenerator)((options) => ({
    __name: 'int',
    toSwagger: () => (0, exports.TypeIsIntToSwagger)(options),
    toSequelize: () => (0, exports.TypeIsIntToSequelize)(options),
    fixValue: exports.TypeIsIntFixValue,
}));
exports.default = TypeIsInt;
//# sourceMappingURL=int.js.map