<?php

namespace App\Http\Resources;

use App\Classes\ValueObjects\Constants\AccountStatus;
use Illuminate\Http\Resources\Json\JsonResource;

class CompanyResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'account_no' => $this->reference_no,
            'name' => $this->name,
            'type' => $this->type,
            'status' => AccountStatus::STATUS[$this->status],
            'delivery_address' => new AddressResource($this->deliveryAddress)
        ];
    }
}
