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

class Vehicle extends Model {}

Vehicle.init(
  {
    vehicleTypeId: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    falukantUserId: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    regionId: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    condition: {
      // current condition of the vehicle (0–100)
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 100,
    },
    availableFrom: {
      // timestamp when the vehicle becomes available for use
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.NOW,
    },
  },
  {
    sequelize,
    modelName: 'Vehicle',
    tableName: 'vehicle',
    schema: 'falukant_data',
    timestamps: true,
    underscored: true,
  }
);

export default Vehicle;


