<?php

namespace App\Models;

use App\Models\BaseModel;

class FamilyGuardian extends BaseModel
{
    protected $table = 'family_guardians';

    // CI model didn't specify timestamps
    public $timestamps = true;

    protected $fillable = [
        'family_id',
        'user_id',
        'relation',
        'is_primary',
        'receive_emails',
        'receive_sms',
        'custody_notes',
        'created_at',
        'updated_at',
    ];

    protected $casts = [
        'family_id'       => 'integer',
        'user_id'         => 'integer',
        'is_primary'      => 'boolean',
        'receive_emails'  => 'boolean',
        'receive_sms'     => 'boolean',
    ];

    // Optional relationships
    public function family()
    {
        return $this->belongsTo(Family::class, 'family_id');
    }

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