<?php

namespace App\Models;

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

class Speerpunt extends Model
{
    use SoftDeletes;

    protected $table = 'speerpunten';

    protected $fillable = [
        'thema_id',
        'naam',
        'beschrijving',
        'eigenaar_id',
        'status',
    ];

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

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

    public function eigenaar(): BelongsTo
    {
        return $this->belongsTo(User::class, 'eigenaar_id');
    }

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