<?php

namespace Modules\Client\Http\Resources;

use App\Http\Resources\BaseResource;
use Modules\Country\Http\Resources\CountryResource;

class ClientResource extends BaseResource
{
    public function toArray($request)
    {
        $arr = [
            'id' => $this->id,
            'name' => $this->name,
            'email' => $this->email,
            'phone' => $this->phone,
            'phone_code' => $this->phone_code,
            'image' => $this->image ? asset($this->image) : '',
            'points' => $this->AvailableLoyaltyPoints(),
            'Country' => CountryResource::make($this->Country),
        ];

        return $arr;
    }
}
