<?php

namespace App\Http\Resources\Expenses;

use Illuminate\Http\Resources\Json\JsonResource;

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