import db from "../../database/db.js";

const ClassModel = (DataTypes) => {
  const Classes = db.define(
    "class",
    {
      ID_CLASS: {
        type: DataTypes.UUID,
        primaryKey: true,
        defaultValue: DataTypes.UUIDV4,
        allowNull: false,
        validate: {
          notEmpty: true,
        },
      },
      NAME_CLASS: {
        type: DataTypes.STRING(100),
        allowNull: false,
        validate: {
          notEmpty: true,
        },
      },
      TOTAL_STUDENT: {
        type: DataTypes.INTEGER(11),
        allowNull: true,
      },
      TIME_CLASS: {
        type: DataTypes.DATE,
        allowNull: true,
        defaultValue: DataTypes.NOW,
      },
    },
    {
      timestamps: false,
      tableName: "class", 
    }
  );
  return Classes;
};

export default ClassModel;
