<?php

namespace Modules\Linksehat\Transformers\Doctor;

use Illuminate\Http\Resources\Json\JsonResource;

class DoctorResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->practitioner_id,
            'name' => $this->person->name ?? '',
            'specialities' => "Spesialis " . $this->speciality->name ?? '',
            'photos' => [
                'title' => 'doctors-avatar-' . $this->practitioner_id,
                'url' => asset('images/default-doctor-avatar.png')
            ]
        ];
    }
}
