import { DataTypes } from 'sequelize'; import { sequelize } from '../../utils/sequelize.js'; const TaxiMap = sequelize.define('TaxiMap', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, name: { type: DataTypes.STRING(100), allowNull: false }, description: { type: DataTypes.TEXT, allowNull: true }, width: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 8, comment: 'Map width in tiles' }, height: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 8, comment: 'Map height in tiles' }, tileSize: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 50, comment: 'Size of each tile in pixels' }, mapTypeId: { type: DataTypes.INTEGER, allowNull: false, comment: 'Reference to TaxiMapType' }, mapData: { type: DataTypes.JSON, allowNull: false, comment: '2D array of map type IDs for each tile position' }, positionX: { type: DataTypes.INTEGER, allowNull: false, comment: 'X position as continuous integer (1, 2, 3, ...)' }, positionY: { type: DataTypes.INTEGER, allowNull: false, comment: 'Y position as continuous integer (1, 2, 3, ...)' }, isActive: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true }, isDefault: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false, comment: 'Whether this is the default map for new games' }, createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW }, updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW } }, { tableName: 'taxi_maps', schema: 'taxi', timestamps: true, indexes: [ { fields: ['name'] }, { fields: ['is_active'] }, { fields: ['is_default'] }, { fields: ['position_x', 'position_y'] }, { unique: true, fields: ['position_x', 'position_y'] } ] }); export default TaxiMap;