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

const ReportModel = (DataTypes) => {
  const Reports = db.define(
    "report",
    {
      ID_REPORT: {
        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",
        },
      },
      REPORTS: {
        type: DataTypes.TEXT,
        allowNull: false,
        validate: {
          notEmpty: true,
        },
      },
      TIME_REPORT: {
        type: DataTypes.DATE,
        allowNull: true,
        defaultValue: DataTypes.NOW,
      },
    },
    {
      timestamps: false,
      tableName: "report",
    }
  );
  return Reports;
};

export default ReportModel;
