<?php

namespace Modules\Payment\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class PaymentResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'booking_id' => $this->booking_id,
            'gateway' => $this->gateway,
            'status' => $this->status,
            'amount' => $this->amount,
            'currency' => $this->currency,
            'gateway_transaction_id' => $this->gateway_transaction_id,
            // The gateway's raw response — the client needs this to render the
            // KBZ Mini App payment sheet (e.g. prepay_id).
            'gateway_payload' => $this->gateway_payload,
            'initiated_at' => $this->initiated_at,
        ];
    }
}
