const { DataTypes } = require("sequelize");
const sequelizeConnect = require("../connection/db");

const TriggerDeliveredOrders = sequelizeConnect.define(
  "trigger_delivered_orders",
  {
    id: {
      type: DataTypes.BIGINT,
      primaryKey: true,
      autoIncrement: true,
    },
    order_id: {
      type: DataTypes.BIGINT,
      allowNull: true,
    },
    order_reference_no: {
      type: DataTypes.STRING(300),
      allowNull: true,
    },
    agent_code: {
      type: DataTypes.STRING(300),
      allowNull: true,
    },
    triggered: {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
    },
    created_at: {
      type: DataTypes.DATE,
      defaultValue: DataTypes.NOW,
    },
    triggered_at: {
      type: DataTypes.DATE,
      allowNull: true,
    },
  },
  {
    tableName: "trigger_delivered_orders",
    timestamps: false,
  },
);

module.exports = TriggerDeliveredOrders;
