const { DataTypes } = require("sequelize");

module.exports = (sequelize) => {
  const DeliveryExpeditionVendor = sequelize.define(
    "deliveryexpeditionvendor",
    {
      id: {
        type: DataTypes.INTEGER,
        autoIncrement: true,
        primaryKey: true,
      },
      creation: { type: DataTypes.DATE, allowNull: false },
      modified: { type: DataTypes.DATE, allowNull: false },
      modified_by: { type: DataTypes.INTEGER, allowNull: false },
      owner: { type: DataTypes.INTEGER, allowNull: false },
      enabled: { type: DataTypes.BOOLEAN, allowNull: false },

      name: { type: DataTypes.STRING(200), allowNull: false },
      contact: { type: DataTypes.STRING(255), allowNull: true },
      notes: { type: DataTypes.TEXT, allowNull: true },

      createdAt: { type: DataTypes.DATE, allowNull: false, field: 'createdAt' },
      updatedAt: { type: DataTypes.DATE, allowNull: false, field: 'updatedAt' },
    },
    {
      tableName: "deliveryexpeditionvendors",
      freezeTableName: true,
    }
  );

  DeliveryExpeditionVendor.associate = (models) => {
    // DeliveryTrip has expedition_vendor_id -> belongsTo here optional
  };

  return DeliveryExpeditionVendor;
};
