<?php

namespace App\Models;

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

class Branch extends Model
{
    use HasFactory;

    protected $fillable = [
        'code',
        'name',
        'address',
        'city',
        'state',
        'phone',
        'email',
        'is_head_office',
        'status',
    ];

    protected function casts(): array
    {
        return [
            'is_head_office' => 'boolean',
        ];
    }

    public function customers(): HasMany
    {
        return $this->hasMany(Customer::class);
    }

    public function accounts(): HasMany
    {
        return $this->hasMany(Account::class);
    }
}
