<?php

namespace App\Models\Institution;

use App\Casts\EmailAddress;
use App\Casts\PhoneNumber;
use App\Trait\BelongsToSolicitor;
use Illuminate\Database\Eloquent\Model;

class InstitutionContact extends Model {
    public $fillable = [
        'solicitor_id',
        'email',
        'telephone',
        'mobile',
        'name',
        'job_title',
        'is_primary'
    ];

    public $casts = [
        'is_primary' => 'boolean',
        'telephone' => PhoneNumber::class,
        'email' => EmailAddress::class
    ];

    use BelongsToSolicitor;

    public function institution() {
        return $this->belongsTo(Institution::class);
    }
}
