import { DataTypes } from 'sequelize';

export default function defineVehicle(sequelize) {
  return sequelize.define(
    'Vehicle',
    {
      id: { type: DataTypes.BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true },
      user_id: { type: DataTypes.BIGINT.UNSIGNED, allowNull: false },
      type: { type: DataTypes.STRING(50), allowNull: false, defaultValue: 'car' },
      brand: { type: DataTypes.STRING(80), allowNull: false },
      model: { type: DataTypes.STRING(80), allowNull: false },
      number_plate: { type: DataTypes.STRING(32), allowNull: false },
      created_at: {
        type: DataTypes.DATE(3),
        allowNull: false,
        defaultValue: DataTypes.NOW,
      },
    },
    { tableName: 'vehicles' }
  );
}
