Appointments

erDiagram
    Participants {
        int ParticipantID PK
        string FullName
        string Email
        string PhoneNumber
        json Demographics
        text Notes
    }
    
    Appointments {
        int AppointmentID PK
        int ParticipantID FK
        array ResearcherIDs FK
        datetime DateTime
        string MeetingLink
        array Documents
        string Status
        text Notes
    }
    
    Users {
        int UserID PK
        string FullName
        string Role
        string Email
        hashed Password
        json Availability
    }
    
    Documents {
        int DocumentID PK
        int AppointmentID FK
        string FileName
        string FileURL
        int UploadedBy FK
        datetime Timestamp
    }
    
    Participants ||--o{ Appointments : "has"
    Users ||--o{ Appointments : "assigned to"
    Appointments ||--o{ Documents : "includes"
    Users ||--o{ Documents : "uploads"
flowchart TD
    Start([Start: User schedules an appointment])
    Login([User logs in])
    ViewDashboard([User views their dashboard])
    CreateAppointment([Create a new appointment])
    FillDetails([Fill details:\nparticipant info,\ndate, time,\nmeeting link])
    SaveAppointment([Save appointment])
    Notify([Notify participants and researchers])
    ViewAppointment([View upcoming appointments])
    EditOrReschedule([Edit or reschedule appointment])
    NotifyUpdate([Notify stakeholders of updates])
    Complete([Complete the appointment])
    Review([Review outcomes])
    End([End])

    Start --> Login --> ViewDashboard --> CreateAppointment
    CreateAppointment --> FillDetails --> SaveAppointment
    SaveAppointment --> Notify --> ViewAppointment
    ViewAppointment --> EditOrReschedule --> NotifyUpdate
    NotifyUpdate --> ViewAppointment
    ViewAppointment --> Complete --> Review --> End

    %% Style adjustments
    style Start fill:#c8e6c9,stroke:#388e3c,stroke-width:2px
    style End fill:#c8e6c9,stroke:#388e