const mongoose = require('mongoose') const { Schema, Types } = mongoose const user = require('./user.model') const dokumen = require('./dokumen.model') const pelanggaran = require('./pelanggaran.model') module.exports = mongoose.model( 'Laporan', new Schema( { no_laporan: { type: String, unique: true }, user: { type: Types.ObjectId, ref: user }, sanksi: { type: Types.ObjectId }, pt: Object, keterangan: String, pelanggaran: [{ type: Types.ObjectId, ref: pelanggaran }], role_data: { type: String, enum: ['dikti', 'lldikti'], default: 'dikti', }, // status: String, aktif: { type: Boolean, default: true }, dokumen: [ { type: Types.ObjectId, ref: dokumen, }, ], jadwal: { judul: String, dari_tanggal: Date, sampai_tanggal: Date, warna: String, }, evaluasi: [ new Schema( { judul: String, tanggal: Date, dokumen: [ { type: Types.ObjectId, ref: dokumen, }, ], }, { timestamps: true, } ), ], }, { timestamps: true, } ), 'laporan' )