<?php

namespace Modules\ClinicCore\Entities;

use Illuminate\Database\Eloquent\Model;
use App\Contact;

class ClcPatientContactDetail extends Model
{
    protected $table = 'clc_patient_contact_details';
    protected $guarded = ['id'];

    protected $casts = [
        'email_confirmed'       => 'boolean',
        'email_confirm_sent_at' => 'datetime',
    ];

    public function contact()
    {
        return $this->belongsTo(Contact::class, 'contact_id');
    }

    public function preferredDoctor()
    {
        return $this->belongsTo(ClcDoctor::class, 'preferred_doctor_id');
    }

    public function pets()
    {
        return $this->hasMany(ClcPatient::class, 'contact_id', 'contact_id');
    }
}
