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

const MultipleChoicesModel = (DataTypes) => {
  const MultipleChoices = db.define(
    "multiple_choices",
    {
      ID_MULTIPLE_CHOICES: {
        type: DataTypes.UUID,
        primaryKey: true,
        defaultValue: DataTypes.UUIDV4,
        allowNull: false,
        validate: {
          notEmpty: true,
        },
      },
      ID_ADMIN_EXERCISE: {
        type: DataTypes.UUID,
        allowNull: false,
        references: {
          model: "admin_exercise",
          key: "ID_ADMIN_EXERCISE",
        },
        validate: {
          notEmpty: true,
        },
      },
      OPTION_A: {
        type: DataTypes.STRING(256),
        allowNull: true,
      },
      OPTION_B: {
        type: DataTypes.STRING(256),
        allowNull: true,
      },
      OPTION_C: {
        type: DataTypes.STRING(256),
        allowNull: true,
      },
      OPTION_D: {
        type: DataTypes.STRING(256),
        allowNull: true,
      },
      OPTION_E: {
        type: DataTypes.STRING(256),
        allowNull: true,
      },
      ANSWER_KEY: {
        type: DataTypes.STRING(100),
        allowNull: false,
      },
      TIME_MULTIPLE_CHOICES: {
        type: DataTypes.DATE,
        allowNull: true,
        defaultValue: DataTypes.NOW,
      },
    },
    {
      timestamps: false,
      tableName: "multiple_choices",
    }
  );

  return MultipleChoices;
};

export default MultipleChoicesModel;
