<?php

namespace App\Models;

use App\Traits\Uuid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Registrasi extends Model
{
    use HasFactory;
    use Uuid;

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

    protected $fillable = [
        'id',
        'nama',
        'nama_depan',
        'email',
        'telepon',
        'instansi',
        'jabatan',
        'id_kegiatan',
        'id_konferensi',
        'alamat',
        'kode_pos',
        'kota',
        'kode_registrasi',
        'tagihan',
        'status_va',
        'tanggal_bayar'
    ];

    public function pkKegiatan(){
        return $this->hasOne(Kegiatan::class, 'id', 'id_kegiatan');
    }

    public function pkKonferensi() {
        return $this->hasOne(Konferensi::class, 'id', 'id_konferensi');
    }

    public function pkRegistrasiPeserta() {
        return $this->hasMany(KegiatanPeserta::class, 'id_registrasi', 'id');
    }
}
