<?php

namespace App\Models;

use App\Models\BaseModel;

class Family extends BaseModel
{
    protected $table = 'families';

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

    protected $fillable = [
        'family_code',
        'household_name',
        'address_line1',
        'address_line2',
        'city',
        'state',
        'postal_code',
        'country',
        'primary_phone',
        'preferred_lang',
        'preferred_contact_method',
        'is_active',
        'created_at',
        'updated_at',
    ];

    protected $casts = [
        'is_active' => 'boolean',
    ];

    /* Optional relationships */
    public function guardians()
    {
        return $this->hasMany(FamilyGuardian::class, 'family_id');
    }

    public function commPrefs()
    {
        return $this->hasMany(FamilyCommPref::class, 'family_id');
    }
}