"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeIsDoubleFixValue = exports.TypeIsDoubleToSequelize = exports.TypeIsDoubleToSwagger = 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.TypeIsDoubleToSwagger = (0, toSwaggerGenerator_1.toSwaggerGenerator)((options) => ({
    type: 'number',
    format: 'double',
    description: options === null || options === void 0 ? void 0 : options.comment,
}));
exports.TypeIsDoubleToSequelize = (0, toSequelizeGenerator_1.toSequelizeGenerator)((options) => (Object.assign(Object.assign({}, options), { type: sequelize_1.DataTypes.DOUBLE(options === null || options === void 0 ? void 0 : options.length, options === null || options === void 0 ? void 0 : options.decimals), comment: options === null || options === void 0 ? void 0 : options.comment })));
const TypeIsDoubleFixValue = (o) => {
    if (o === undefined || o === null)
        return o;
    return parseFloat(String(o));
};
exports.TypeIsDoubleFixValue = TypeIsDoubleFixValue;
const TypeIsDouble = (0, typeGenerator_1.typeGenerator)((options) => ({
    __name: 'double',
    toSwagger: () => (0, exports.TypeIsDoubleToSwagger)(options),
    toSequelize: () => (0, exports.TypeIsDoubleToSequelize)(options),
    fixValue: exports.TypeIsDoubleFixValue,
}));
exports.default = TypeIsDouble;
//# sourceMappingURL=double.js.map