<?php

namespace KupShop\GraphQLBundle\ApiPos\Controller;

use KupShop\GraphQLBundle\ApiAdmin\Controller\UserController;
use KupShop\GraphQLBundle\ApiPos\Types\User\User;
use TheCodingMachine\GraphQLite\Annotations\Query;

class PosUserController extends UserController
{
    #[Query]
    public function user(?int $id, ?string $email, ?string $cartId): ?User
    {
        /** @var \KupShop\GraphQLBundle\ApiAdmin\Types\User\User $user */
        $user = $this->userUtil->getUser($id, $email, $cartId);
        if ($user) {
            return new User($user->user);
        }

        return null;
    }
}
