<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Penilaian extends Model
{
    use HasFactory;

    protected $table = 'penilaian';

    protected $fillable = [
        'nim_mahasiswa',
        'nip_penguji',
        'penguji_ke',
        'catatan',
        'nilai_total'
    ];

    public function mahasiswa()
    {
        return $this->belongsTo(Mahasiswa::class, 'nim_mahasiswa', 'nim');
    }

    public function penguji()
    {
        return $this->belongsTo(Dosen::class, 'nip_penguji', 'nip');
    }

    public function detail()
    {
        return $this->hasMany(PenilaianDetail::class, 'penilaian_id');
    }
}
