<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\HasOne;

# use Illuminate\Database\Eloquent\Model;

class Appointment extends Model
{
    protected $table = 'appointment';

    public function client() {
        return $this->hasOne(Client::class, 'id', 'client_id');
    }

    public function pro() {
        return $this->hasOne(Pro::class, 'id', 'pro_id');
    }

    public function confirmationRequests() {
        return $this->hasMany(AppointmentConfirmationRequest::class, 'appointment_id', 'id')
            ->orderBy('created_at', 'desc');
    }

    public function confirmationDecisions() {
        return $this->hasMany(AppointmentConfirmationDecision::class, 'appointment_id', 'id')
            ->orderBy('created_at', 'desc');
    }
}
