<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class DetailSaw extends Model
{
   protected $fillable = [
        'hasil_saw_id',
        'kriteria_id',
        'subkriteria_id',
        'opsi_subkriteria_id',
        'nilai_normalisasi',
        'nilai_bobot',
        'skor_akhir'
    ];

    protected $casts = [
        'nilai_normalisasi' => 'float',
        'nilai_bobot' => 'float',
        'skor_akhir' => 'float'
    ];

    public function opsisubkriteria()
    {
        return $this->belongsTo(OpsiSubkriteria::class);
    }
    
    public function hasilsaw()
    {
        return $this->belongsTo(HasilSaw::class);
    }

    public function kriteria()
    {
        return $this->belongsTo(Kriteria::class);
    }

    public function subkriteria()
    {
        return $this->belongsTo(Subkriteria::class);
    }
}
