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

const Warehouses = sequelizeConnect.define(
  "warehouses",
  {
    id: {
      type: DataTypes.BIGINT,
      primaryKey: true,
      autoIncrement: true,
    },
    code: {
      type: DataTypes.STRING(20),
      allowNull: false,
      unique: true,
    },
    name: {
      type: DataTypes.STRING(100),
      allowNull: false,
    },
    location: {
      type: DataTypes.STRING(200),
      allowNull: true,
    },
    status: {
      type: DataTypes.BOOLEAN,
      defaultValue: true,
    },
  },
  {
    tableName: "warehouses",
    timestamps: true,
  }
);

module.exports = Warehouses;