enum EVENT_TYPE {
    COURSE
    OBLIGATED_COURSE
    EVENT
}

model EventAppointment {
    id              Int           @id @default(autoincrement())
    eventId         Int
    appointmentDate DateTime
    presenterId     String
    // relations:
    Users           User[]        @relation("EventAppointmentUser")
    Participants    Participant[]
    Event           Event         @relation(fields: [eventId], references: [id])
    Presenter       User          @relation(fields: [presenterId], references: [id])
}

model Participant {
    id                           Int      @id @default(autoincrement())
    userId                       String   @map(name: "user_id")
    finisherMoodleCurseCompleted Boolean  @default(false)
    attended                     Boolean  @default(false)
    appointmentCancelled         Boolean  @default(false)
    completetionWorkflowFinished Boolean  @default(false)
    eventAppointmentId           Int?
    enscriptionDate              DateTime @default(now())

    statusLog        Json[]            @default([])
    eventId          Int
    // relations:
    User             User              @relation(fields: [userId], references: [id])
    Event            Event             @relation(fields: [eventId], references: [id])
    EventAppointment EventAppointment? @relation(fields: [eventAppointmentId], references: [id])
}

model Event {
    id                     Int          @id @default(autoincrement())
    name                   String
    description            String
    type                   EVENT_TYPE   @default(EVENT)
    discordRoleId          String?      @default("")
    hasPresenceEvents      Boolean      @default(false)
    maxParticipants        Int?         @default(0)
    finisherMoodleCourseId String?      @default("")
    finishedBadges         BADGES[]     @default([])
    requiredBadges         BADGES[]     @default([])
    finishedPermissions    PERMISSION[] @default([])
    hidden                 Boolean      @default(true)

    // relations:
    participants Participant[]
    appointments EventAppointment[]
}

model File {
    id Int @id @default(autoincrement())

    // Weitere Felder für das File-Modell
}
