<?php

namespace App\Models;

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

class Purchase extends Model
{
    use HasFactory;

    protected $fillable = [
        'vendor_id',
        'item_id',
        'item_category',
        'invoice_no',
        'purchase_date',
        'item_type',
        'quantity',
        'cost',
        'payment_type',
        'notes',
    ];

    protected $casts = [
        'purchase_date' => 'date',
    ];

    public function vendor()
    {
        return $this->belongsTo(Vendor::class);
    }

    public function item()
    {
        return $this->belongsTo(Item::class);
    }

    public function currency()
    {
        return $this->belongsTo(Currency::class);
    }
}
