<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;use Illuminate\Http\Resources\Json\JsonResource;
class LedgerEntryResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return ['id'=>$this->id,'merchant_id'=>$this->merchant_id,'transfer_id'=>$this->transfer_id,'settlement_batch_id'=>$this->settlement_batch_id,'direction'=>$this->direction->value,'amount'=>new MoneyResource($this->amount_minor,$this->currency),'currency'=>$this->currency,'type'=>$this->type->value,'balance_after'=>new MoneyResource($this->balance_after_minor,$this->currency),'note'=>$this->note,'created_by'=>$this->created_by,'created_at'=>$this->created_at->toISOString()];
    }
}
