const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');

const Vehicle = sequelize.define('vehicles', {
  id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
  vehicle_code: { type: DataTypes.STRING(20), unique: true, allowNull: false },
  vehicle_type: { type: DataTypes.ENUM('economy', 'vip', 'premium', 'standard'), allowNull: false },
  vehicle_name: { type: DataTypes.STRING(50), allowNull: false },
  capacity: { type: DataTypes.INTEGER, allowNull: false },
  has_trailer: { type: DataTypes.BOOLEAN, defaultValue: false },
  has_ac: { type: DataTypes.BOOLEAN, defaultValue: true },
  has_wifi: { type: DataTypes.BOOLEAN, defaultValue: false },
  has_bathroom: { type: DataTypes.BOOLEAN, defaultValue: false },
  has_usb_charging: { type: DataTypes.BOOLEAN, defaultValue: false },
  has_tv_entertainment: { type: DataTypes.BOOLEAN, defaultValue: false },
  extra_features: { type: DataTypes.TEXT },
  license_plate: { type: DataTypes.STRING(20) },
  vehicle_image: { type: DataTypes.STRING(255) },
  interior_image: { type: DataTypes.STRING(255) },
  exterior_image: { type: DataTypes.STRING(255) },
  gallery_images: { type: DataTypes.JSON },
  is_active: { type: DataTypes.BOOLEAN, defaultValue: true },
}, {
  timestamps: true,
  createdAt: 'created_at',
  updatedAt: 'updated_at',
});

module.exports = Vehicle;
