<?php

namespace App\Http\Resources\Accounting;

use Illuminate\Http\Resources\Json\JsonResource;

class DepreciationPaymentResource extends JsonResource
{

    public function toArray($request)
    {
        return [
            'id'           => $this->id,
            'branch_id'    => $this->branch_id,
            'paid_date'    => $this->paid_date,
            'paid'         => $this->paid,
            'loan_balance' => $this->loan_balance,
            'payment_amount' => $this->unpaid??0,

            'asset_name'        => $this->depreciationDetail->depreciation->asset_name??'',
            'brand'             => $this->depreciationDetail->depreciation->brand??'',
            'invoice_number'    => $this->depreciationDetail->depreciation->invoice_number??'',
            'depreciation_date' => $this->depreciationDetail->depreciation->depreciation_date??'',
            'total_amount'      => $this->depreciationDetail->depreciation->total_amount??'',

            'currency_name'    => $this->currency_id==1?'រៀល':'ដុល្លារ',
        ];
    }
}
