public function typesAction(Request $request)
    {
        $component = $request->request->get('component');

        $taskTypes = $this->get('phlexible_task.types');

        $types = [];
        foreach ($taskTypes->all() as $type) {
            /* @var $type TypeInterface */
            if ($component && $type->getComponent() !== $component) {
                continue;
            }

            $types[] = [
                'id' => $type->getName(),
                'name' => $type->getName(),
            ];
        }

        return new JsonResponse(['types' => $types]);
    }