<?php

namespace App\Api\Resources\User;

use Illuminate\Http\Resources\Json\JsonResource;

class UserDataResource extends JsonResource
{

    public function toArray($request): array
    {
        return [
            'user_id'           => $this->id,
            'username'          => $this->username,
            'nickname'          => $this->info->nickname,
            'orders_count'      => $this->orders_count,
            'orders_sum_amount' => $this->orders_sum_amount,
            'avatar'            => $this->info->avatar ?? '',
        ];
    }

}
