<?php

namespace App\Models\User;

use App\Models\Biodata;
use App\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;

class KekayaanIntelektual extends Model
{
    use UuidTrait;

    public $incrementing = false;
    protected $table = 'kekayaanintelektual';
    protected $keyType = 'string';

    protected $fillable = ['judul_hki', 'jenis', 'status', 'nopendaftaran', 'nidn', 'userid_created', 'user_id_updated'];

    public const RULES = [
        'judul_hki' => 'required',
        'jenis' => 'required',
        'status' => 'required',
        'nopendaftaran' => 'required',
        'nidn' => 'required',
    ];

    public const ERROR_MESSAGES = [
        'judul_hki.required' => 'Judul tidak boleh kosong',
        'jenis.required' => 'Jenis tidak boleh kosong',
        'status.required' => 'Status tidak boleh kosong',
        'nopendaftaran.required' => 'No pendaftaran tidak boleh kosong',
        'nidn.required' => 'NIDN tidak tervalidasi atau kosong',
    ];

    public function dosen()
    {
        return $this->belongsTo(Biodata::class, 'nidn', 'nidn');
    }
}
