<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class RehabilitationMeeting extends Model
{
    protected $table = 'rehabilitation_meetings';

    protected $fillable = [
        'rehabilitation_request_id',
        'meeting_date',
        'location',
        'notes',
        'status',
        'created_by',
    ];

    protected $casts = [
        'meeting_date' => 'datetime',
    ];

    public function request(): BelongsTo
    {
        return $this->belongsTo(RehabilitationRequest::class, 'rehabilitation_request_id');
    }

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

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

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