<?php

namespace App\Models;

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

class Branch extends Model
{
    use HasFactory;

    protected $keyType = 'string';
    public $incrementing = false;

    protected $fillable = [
        'id',
        'company_id',
        'name',
        'code',
        'balance',
        'opening_balance',
        'manager_name',
        'status'
    ];

    /**
     * Association with parent client
     */
    public function company()
    {
        return $this->belongsTo(Company::class, 'company_id');
    }

    /**
     * Association with transactions registered at this branch
     */
    public function transactions()
    {
        return $this->hasMany(CashTransaction::class, 'branch_id');
    }
}
