const { DataTypes } = require("sequelize");
const sequelize = require("../db");

/**
 * Minutes of Meeting (MoM) Model
 * 
 * Description:
 * The Minutes of Meeting Module is used to document structured records of meetings.
 * It captures essential details such as project name, agenda, attendance, and updates,
 * while linking discussions to specific cases and responsibilities. This ensures
 * traceability, accountability, and follow-up.
 * 
 * Key Features:
 * - Structured Meeting Details: Captures meeting metadata (date, time, location, purpose)
 * - Attendance Tracking: Records participants and their presence status
 * - Agenda & Background: Documents meeting agenda items and background context
 * - Attachments: Supports file attachments for meeting-related documents
 * 
 * Data Structure (JSON):
 * {
 *   // Meeting Information
 *   meetingTitle: string,
 *   meetingDate: date,
 *   meetingTime: string,
 *   location: string,
 *   meetingPurpose: string,
 *   
 *   // Agenda & Background
 *   agenda: string,
 *   background: string,
 *   
 *   // Participants
 *   participants: [
 *     {
 *       name: string,
 *       role: string,
 *       present: boolean,
 *       email: string
 *     }
 *   ],
 *   
 *   // Discussion Items
 *   discussionItems: [
 *     {
 *       topic: string,
 *       description: string,
 *       responsiblePerson: string,
 *       dueDate: date,
 *       status: "pending" | "in-progress" | "completed",
 *       caseReference: string
 *     }
 *   ],
 *   
 *   // Decisions & Actions
 *   decisions: [
 *     {
 *       decision: string,
 *       actionRequired: string,
 *       assignedTo: string,
 *       deadline: date
 *     }
 *   ],
 *   
 *   // Attachments
 *   attachments: [
 *     {
 *       fileName: string,
 *       filePath: string,
 *       uploadedBy: string,
 *       uploadedAt: date
 *     }
 *   ],
 *   
 *   // Next Meeting
 *   nextMeetingDate: date,
 *   nextMeetingAgenda: string,
 *   
 *   // Metadata
 *   preparedBy: string,
 *   reviewedBy: string,
 *   approvedBy: string,
 *   status: "draft" | "reviewed" | "approved" | "archived"
 * }
 */
const MinutesOfMeeting = sequelize.define("MinutesOfMeeting", {
  data: {
    type: DataTypes.JSON,
    allowNull: true,
    comment: 'Stores all meeting details including agenda, attendance, discussions, decisions, and attachments in JSON format for flexibility',
  },
}, {
  tableName: 'MinutesOfMeetings',
  comment: 'Minutes of Meeting - Documents structured records of meetings with traceability and accountability'
});

module.exports = MinutesOfMeeting;
