<?php 

namespace NPS\Controller;

use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\HttpFoundation\Response;
use NPS\DependencyInjection\KnowledgeBaseManager;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventDispatcher;
use NPS\Event\LanguageChangedEvent;

class DefaultController extends AbstractController
{
    /**
     * @Route("/auth")
     * @IsGranted("ROLE_USER")
     */
    public function authAction()
    {
        $user = $this->getUser();

        return $this->response([
            'user' => [
                'email' => $user->getEmail(),
                'username' => $user->getUsername(),
                'roles' => $user->getRoles()
            ]
        ]);
    }
}

