<?php

declare(strict_types=1);

namespace MauticPlugin\DealFlowBundle\Controller;

use Mautic\CoreBundle\Controller\CommonController;
use MauticPlugin\DealFlowBundle\Service\DealAuthorization;
use Symfony\Component\HttpFoundation\Response;

final class ApiDocsController extends CommonController
{
    public function indexAction(
        DealAuthorization $authorization,
    ): Response {
        if (!$authorization->canViewSettings()) {
            return $this->accessDenied();
        }

        return $this->delegateView([
            'viewParameters' => [],
            'contentTemplate' => '@DealFlow/ApiDocs/index.html.twig',
            'passthroughVars' => [
                'activeLink' => '#mautic_dealflow_api_docs',
                'route' => $this->generateUrl('mautic_dealflow_api_docs'),
                'mauticContent' => 'dealflow',
            ],
        ]);
    }
}
