<?php

namespace App\Models;
use App\Models\DataAlumni;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class HasilKlasifikasi extends Model
{
    use HasFactory;

    protected $table = 'hasil_klasifikasi';
    protected $primaryKey = 'id_hasil_klasifikasi';
    public $incrementing = true;
    protected $keyType = 'int';


    protected $fillable = [
        'id_alumni',
        'cluster',
        'iterasi',
        'centroid_awal',
        'centroid_akhir'
    ];

    protected $casts = [
        'centroid_awal' => 'array',
        'centroid_akhir' => 'array',
    ];
    
        public function dataAlumni()
    {
        return $this->belongsTo(DataAlumni::class, 'id_alumni', 'id_alumni');
    }
    public function tahunAngkatan()
    {
        return $this->belongsTo(TahunAngkatan::class, 'angkatan', 'id_angkatan');
    }
}
