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

const TeacherModel = (DataTypes) => {
  const Teachers = db.define(
    "teacher",
    {
      ID_GURU: {
        type: DataTypes.UUID,
        primaryKey: true,
        defaultValue: DataTypes.UUIDV4,
        allowNull: false,
        validate: {
          notEmpty: true,
        },
      },
      ID: {
        type: DataTypes.UUID,
        allowNull: false,
        validate: {
          notEmpty: true,
        },
        references: {
          model: "users",
          key: "ID",
        },
      },
      NIP: {
        type: DataTypes.BIGINT(11),
        allowNull: false,
        unique: true,
        validate: {
          notEmpty: true,
        },
      },
    },
    {
      timestamps: false,
      tableName: "teacher",
    }
  );
  return Teachers;
};

export default TeacherModel;
