<?php

namespace App\Http\Resources\Reimbursements;

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

class ReimbursementUnderProcessingItemResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => (int) ($this->resource['id'] ?? 0),
            'expense_id' => (int) ($this->resource['expense_id'] ?? 0),
            'reimbursement_id' => $this->resource['reimbursement_id'] ?? null,
            'expense_amount' => (float) ($this->resource['expense_amount'] ?? 0),
            'vendor' => $this->resource['vendor'] ?? null,
            'description' => $this->resource['description'] ?? null,
            'purchased_by' => $this->resource['purchased_by'] ?? null,
            'receipt_url' => $this->resource['receipt_url'] ?? null,
            'batch_id' => $this->resource['batch_id'] ?? null,
            'batch_label' => $this->resource['batch_label'] ?? null,
            'admin_id' => $this->resource['admin_id'] ?? null,
            'admin_name' => $this->resource['admin_name'] ?? null,
            'batch_number' => (int) ($this->resource['batch_number'] ?? 0),
        ];
    }
}
