<?php

namespace Modules\User\Entities;
    
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Auth\Entities\User;

class Heir extends Model
{
    /** @use HasFactory<\Modules\User\Database\Factories\HeirFactory> */
    use HasUuids;

    protected $table = 'heirs';

    /**
     * The attributes that are mass assignable.
     *
     * @var list<string>
     */
    protected $fillable = [
        'user_id',
        'name',
        'ic_number',
        'relationship',
        'phone_number',
        'address',
        'is_primary',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var list<string>
     */
    protected $hidden = [
    ];

    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'name' => 'string',
            'ic_number' => 'string',
            'relationship' => 'string',
            'phone_number' => 'string',
            'address' => 'string',
            'is_primary' => 'boolean',
        ];
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
