<?php 

namespace App\Http\Resources\Invoice;

use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\User;
use App\Http\Resources\BaseJsonResource;

class InvoiceConsumableDetailResource extends BaseJsonResource
{
    public function toArray($request)
    {
        //dd($this->packingDetail);
        $array = [
            'consumable_item' => new \App\Http\Resources\Consumable\ConsumableItemResource($this->consumableItem),
            'unit_price' => $this->unit_price,
            'qty' => $this->qty,
            'amount' => $this->amount,
            'cgst' => $this->hNull($this->cgst),
            'sgst' => $this->hNull($this->sgst),
            'igst' => $this->hNull($this->igst),
            'cgst_value' => $this->cgst_value,
            'igst_value' => $this->igst_value,
            'sgst_value' => $this->sgst_value,
            'net_gst' => $this->net_gst,
            'discount' => $this->hNull($this->discount),
            'discount_val' => $this->discount_val,
            'net_amount' => $this->net_amount
        ];
        $array = $this->base($array);
        
        return $array;
    }
}