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

const Driver = sequelize.define('drivers', {
  id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
  driver_code: { type: DataTypes.STRING(20), unique: true, allowNull: false },
  full_name: { type: DataTypes.STRING(100), allowNull: false },
  phone: { type: DataTypes.STRING(20), allowNull: false },
  email: { type: DataTypes.STRING(100), unique: true },
  license_number: { type: DataTypes.STRING(50), allowNull: false },
  license_expiry: { type: DataTypes.DATEONLY },
  vehicle_id: { type: DataTypes.INTEGER },
  is_active: { type: DataTypes.BOOLEAN, defaultValue: true },
  profile_image: { type: DataTypes.STRING(255) },
}, {
  timestamps: true,
  createdAt: 'created_at',
  updatedAt: 'updated_at',
});

module.exports = Driver;
