<?php

namespace App\Models;

use App\Enums\BesluitStatus;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Besluit extends Model
{
    protected $table = 'besluiten';

    protected $fillable = [
        'project_id',
        'titel',
        'beschrijving',
        'datum',
        'type',
        'status',
        'onderbouwing',
    ];

    protected function casts(): array
    {
        return [
            'status' => BesluitStatus::class,
            'datum'  => 'date',
        ];
    }

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

    public function commitments(): HasMany
    {
        return $this->hasMany(Commitment::class);
    }
}
