<?php

namespace App\Models;

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

class Jurusan extends Model
{
    use HasFactory;
    
    protected $table = 'jurusan';

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'campus_id',
        // Kolom baru untuk ID Prodi dari Siakad
        'prodi_siakad_id', 
        'name',
        'program_kuliah',
        'registration_fees', 
        'initial_fee',
        'biaya_awal_description', 
        'normal_monthly_fee',
        'promo_monthly_fee',
        'is_active',
        // Kolom biaya_pendaftaran tetap dipertahankan
        'biaya_pendaftaran', 
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'registration_fees' => 'array', 
        'is_active' => 'boolean',
    ];

    /**
     * Get the campus that owns the Jurusan.
     */
    public function campus(): BelongsTo
    {
        // Ganti dengan nama Model Kampus yang sebenarnya jika berbeda dari 'Campus'
        return $this->belongsTo(Campus::class); 
    }
}