<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;use Illuminate\Http\Resources\Json\JsonResource;
class SettlementBatchResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return ['id'=>$this->id,'batch_ref'=>$this->batch_ref,'merchant_id'=>$this->merchant_id,'currency'=>$this->currency,'period_from'=>$this->period_from->toISOString(),'period_to'=>$this->period_to->toISOString(),'gross_collected'=>new MoneyResource($this->gross_collected_minor,$this->currency),'gross_paid'=>new MoneyResource($this->gross_paid_minor,$this->currency),'net_position'=>new MoneyResource($this->net_position_minor,$this->currency),'status'=>$this->status->value,'reference'=>$this->reference,'settled_on'=>$this->settled_on?->toDateString(),'settled_by'=>$this->settled_by,'note'=>$this->note,'created_at'=>$this->created_at?->toISOString()];
    }
}
