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

const MatchingPairsModel = (DataTypes) => {
  const MatchingPairs = db.define(
    "matching_pairs",
    {
      ID_MATCHING_PAIRS: {
        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,
        },
      },
      LEFT_PAIR: {
        type: DataTypes.TEXT,
        allowNull: true,
      },
      RIGHT_PAIR: {
        type: DataTypes.TEXT,
        allowNull: true,
      },
      TIME_MATCHING_PAIRS: {
        type: DataTypes.DATE,
        allowNull: true,
        defaultValue: DataTypes.NOW,
      },
    },
    {
      timestamps: false,
      tableName: "matching_pairs",
    }
  );

  return MatchingPairs;
};

export default MatchingPairsModel;
