import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';

class VehicleType extends Model {}

VehicleType.init(
  {
    tr: { 
      type: DataTypes.STRING,
      allowNull: false,
      unique: true, 
    },
    cost: {
      // base purchase cost of the vehicle
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    buildTimeMinutes: {
      // time to construct the vehicle, in minutes
      type: DataTypes.INTEGER,
      allowNull: false, 
      defaultValue: 0,
    },
    capacity: {
      // transport capacity (e.g. in units of goods)
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    transportMode: {
      // e.g. 'land', 'water', 'air'
      type: DataTypes.STRING,
      allowNull: false,
    },
    speed: {
      // abstract speed value, higher = faster
      type: DataTypes.INTEGER,
      allowNull: false,
    },
  },
  {
    sequelize,
    modelName: 'VehicleType',
    tableName: 'vehicle',
    schema: 'falukant_type',
    timestamps: false,
    underscored: true,
  }
);

export default VehicleType;


