<?php

declare(strict_types=1);

namespace App\Http\Controllers\API\V1\Auth;

use Dingo\Api\Http\Response;
use Dingo\Api\Routing\Helpers;
use Illuminate\Routing\Controller;
use App\Http\Controllers\API\V1\Auth\Transformers\PouzivatelTransformer;

/**
 * Class MeAction
 *
 * @package App\Http\Controllers\API\V1\Auth
 */
class MeAction extends Controller
{
    use Helpers;

    /**
     * @return \Dingo\Api\Http\Response
     */
    public function __invoke(): Response
    {
        /** @var \App\Models\Pouzivatel\Pouzivatel $pouzivatel */
        $pouzivatel = auth()->user();

        return $this->response->item($pouzivatel, PouzivatelTransformer::class, ['key' => 'pouzivatel']);
    }
}
