grthtrhthjhtyjytjytkergtrhtrjytjerhrfh<?php

namespace App\Models;

use App\Models\Concerns\UuidModel;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Supplier extends Model
{
    use UuidModel;

    protected $fillable = [
        'name', 'phone', 'address',
        'total_purchases', 'total_paid', 'balance',
    ];

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

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

    public function purchases(): HasMany
    {
        return $th