<?php

namespace App\Http\Resources\Expenses;

use Illuminate\Http\Resources\Json\JsonResource;

class ExpenseResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => $this['id'] ?? $this->id,
            'category' => $this['category'] ?? $this->category,
            'amount' => $this['amount'] ?? $this->amount,
            'receipt_path' => $this['receipt_path'] ?? $this->receipt_path,
            'receipt_url' => $this['receipt_url'] ?? null,
            'description' => $this['description'] ?? $this->description,
            'retailor' => $this['retailor'] ?? $this->retailor,
            'date_of_purchase' => $this['date_of_purchase'] ?? $this->date_of_purchase,
            'purchased_by' => $this['purchased_by'] ?? $this->purchased_by,
            'added_by' => $this['added_by'] ?? $this->added_by,
            'school_year' => $this['school_year'] ?? $this->school_year,
            'semester' => $this['semester'] ?? $this->semester,
            'status' => $this['status'] ?? $this->status,
            'status_reason' => $this['status_reason'] ?? $this->status_reason,
            'approved_by' => $this['approved_by'] ?? $this->approved_by,
            'updated_by' => $this['updated_by'] ?? $this->updated_by,
            'purchaser_firstname' => $this['purchaser_firstname'] ?? null,
            'purchaser_lastname' => $this['purchaser_lastname'] ?? null,
            'approver_firstname' => $this['approver_firstname'] ?? null,
            'approver_lastname' => $this['approver_lastname'] ?? null,
        ];
    }
}
