<?php

namespace App\Models;

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

class QuotationItem extends Model
{
    protected $fillable = [
        'quotation_id', 'item_id', 'item_name', 'description', 'hsn_sac', 'unit',
        'quantity', 'rate', 'discount_percent', 'discount',
        'tax_rate', 'cgst_rate', 'sgst_rate', 'igst_rate',
        'tax_amount', 'cgst_amount', 'sgst_amount', 'igst_amount', 'amount',
    ];

    protected $casts = [
        'quantity' => 'decimal:3',
        'rate' => 'decimal:2',
        'discount_percent' => 'decimal:2',
        'discount' => 'decimal:2',
        'tax_rate' => 'decimal:2',
        'tax_amount' => 'decimal:2',
        'amount' => 'decimal:2',
    ];

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