import { Document, Schema, model } from 'mongoose';

enum Severity {
  LOW,
  MEDIUM,
  HIGH,
}

export interface JudgementInterface extends Document {
  jid: string,
  userID: string,
  enteredBy: string,
  /**
   * - 0: LOW
   * - 1: MEDIUM
   * - 2: HIGH
   */
  severity: Severity,
  date: Date,
  expires: Date | null | undefined,
  description: string,
}

const Judgement: Schema = new Schema({
  jid: String,
  userID: String,
  enteredBy: String,
  severity: Number,
  date: Date,
  expires: Date,
  description: String,
});

export default model<JudgementInterface>('Judgement', Judgement);
