<?php

namespace App\Models;

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

class ContractDependent extends Model
{
    use HasFactory;

    protected $fillable = [
        'contract_id',
        'name',
        'phone',
        'relationship',
        'gender',
        'date_of_birth',
    ];

    protected function casts(): array
    {
        return [
            'gender'        => 'integer',
            'date_of_birth' => 'date',
        ];
    }

    /**
     * Relationship: Contract
     */
    public function contract()
    {
        return $this->belongsTo(Contract::class);
    }
}
