<?php

namespace App\Models;

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

class QuestionKpRelation extends Model
{
    use HasFactory;

    protected $table = 'question_kp_relations';

    protected $fillable = [
        'question_id',
        'kp_code',
        'weight',
    ];

    protected $casts = [
        'weight' => 'float',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function question(): BelongsTo
    {
        return $this->belongsTo(Question::class);
    }
}
