<?php

namespace App\Models;

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

class Appointment extends Model
{
    use HasFactory;

    protected $fillable = [
        'status',
        'cancelation_reason',
        'appointment_type',
        'speciality_id',
        'description',
        'duration_minutes',
        'start_time',
        'end_time',
        'organization_id',
        'comment',
        'patient_instruction'
    ];

    public function appointmentParticipants()
    {
        return $this->hasMany(AppointmentParticipant::class, 'appointment_id');
    }

    public function speciality()
    {
        return $this->belongsTo(Speciality::class, 'speciality_id');
    }

    public function organization()
    {
        return $this->belongsTo(Organization::class, 'organization_id');
    }
}
