<?php

namespace App\Models\User;

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

class PublikasiJurnalAnggota extends Model
{
    use HasFactory;
    use UuidTrait;
    public $incrementing = false;
    protected $table = 'publikasijurnal_anggota';
    protected $keyType = 'string';

    protected $fillable = [
        'nama', 'publikasijurnal_id', 'nidn', 'peran', 'tugas', 'institusi', 'jenis', 'userid_created', 'userid_updated', 'created_at', 'updated_at',
    ];

    public const RULES = [
        'nama' => 'required',
        'publikasijurnal_id' => 'required',
        'peran' => 'required',
        'jenis' => 'required'
    ];

    public const ERROR_MESSAGES = [
        'nama.required' => 'nama tidak boleh kosong',
        'publikasijurnal_id.required' => 'publikasijurnal tidak boleh kosong',
        'peran.required' => 'peran tidak boleh kosong',
        'jenis' => 'jenis tidak boleh kosong'
    ];

    public const KEANGGOTAAN = [
        'k'=>'Ketua',
        'a'=>'Anggota'
    ];

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