<?php

namespace App\Models;

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

class Invoice extends BaseModel
{
    protected $guarded = ['id'];
    protected $casts = [
        'issueDate' => 'date',
        'dueDate' => 'date',
        'amount' => 'decimal:2',
        'paidAmount' => 'decimal:2',
    ];

    public function vendor(): BelongsTo { return $this->belongsTo(Vendor::class); }
    public function project(): BelongsTo { return $this->belongsTo(Project::class); }
    public function payments(): HasMany { return $this->hasMany(Payment::class); }
}
