<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class CreditBalance extends Model
{
    protected $fillable = [
        'shareholder_id',
        'branch_id',
        'balance',
        'wallet',
    ];

    protected $casts = [
        'balance' => 'decimal:2',
        'wallet' => 'decimal:2',
    ];

    public function shareholder(): BelongsTo
    {
        return $this->belongsTo(User::class, 'shareholder_id');
    }

    public function branch(): BelongsTo
    {
        return $this->belongsTo(Branch::class);
    }
}
