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

const Route = sequelize.define('routes', {
  id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
  route_code: { type: DataTypes.STRING(20), unique: true, allowNull: false },
  origin: { type: DataTypes.STRING(100), allowNull: false },
  destination: { type: DataTypes.STRING(100), allowNull: false },
  country_origin: { type: DataTypes.STRING(50), allowNull: false },
  country_destination: { type: DataTypes.STRING(50), allowNull: false },
  distance_km: { type: DataTypes.INTEGER },
  estimated_duration_hours: { type: DataTypes.DECIMAL(3, 1) },
  is_active: { type: DataTypes.BOOLEAN, defaultValue: true },
  description: { type: DataTypes.TEXT },
}, {
  timestamps: true,
  createdAt: 'created_at',
  updatedAt: 'updated_at',
});

module.exports = Route;
