<?php

declare(strict_types=1);

use MauticPlugin\DealFlowBundle\Command\UpdateCommand;
use MauticPlugin\DealFlowBundle\Compat\DealFlowCompatExtension;
use MauticPlugin\DealFlowBundle\Compat\MauticVersionAdapter;
use MauticPlugin\DealFlowBundle\Controller\Api\DealApiController;
use MauticPlugin\DealFlowBundle\Controller\ApiDocsController;
use MauticPlugin\DealFlowBundle\Controller\DashboardAjaxController;
use MauticPlugin\DealFlowBundle\Controller\DealAttachmentController;
use MauticPlugin\DealFlowBundle\Controller\DealBatchController;
use MauticPlugin\DealFlowBundle\Controller\DealController;
use MauticPlugin\DealFlowBundle\Controller\DealFieldController;
use MauticPlugin\DealFlowBundle\Controller\DealFormController;
use MauticPlugin\DealFlowBundle\Controller\DealListController;
use MauticPlugin\DealFlowBundle\Controller\DealViewAjaxController;
use MauticPlugin\DealFlowBundle\Controller\DealViewController;
use MauticPlugin\DealFlowBundle\Controller\InboundWebhookSourceController;
use MauticPlugin\DealFlowBundle\Controller\PipelineController;
use MauticPlugin\DealFlowBundle\Controller\ReportController;
use MauticPlugin\DealFlowBundle\Controller\StageController;
use MauticPlugin\DealFlowBundle\Controller\TaskController;
use MauticPlugin\DealFlowBundle\Controller\UpdateController;
use MauticPlugin\DealFlowBundle\Controller\WebhookController;
use MauticPlugin\DealFlowBundle\Entity\DealAuditEventRepository;
use MauticPlugin\DealFlowBundle\Entity\DealContactAssociationRepository;
use MauticPlugin\DealFlowBundle\Entity\DealFieldRepository;
use MauticPlugin\DealFlowBundle\Entity\DealNoteRepository;
use MauticPlugin\DealFlowBundle\Entity\DealRepository;
use MauticPlugin\DealFlowBundle\Entity\DealStageRepository;
use MauticPlugin\DealFlowBundle\Entity\DealTaskRepository;
use MauticPlugin\DealFlowBundle\Entity\PipelineRepository;
use MauticPlugin\DealFlowBundle\EventSubscriber\CampaignSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\CompanyViewSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\ConfigSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\ContactTimelineSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\ContactViewSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\DashboardSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\DeprecationSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\GlobalSearchSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\IntegrationConfigSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\LeadListSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\LicenseMenuSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\LicenseRouteGuard;
use MauticPlugin\DealFlowBundle\EventSubscriber\LicenseValidationSubscriber;
use MauticPlugin\DealFlowBundle\EventSubscriber\WebhookSubscriber;
use MauticPlugin\DealFlowBundle\Form\Type\CampaignDealCreateActionType;
use MauticPlugin\DealFlowBundle\Form\Type\CampaignDealMatchConditionType;
use MauticPlugin\DealFlowBundle\Form\Type\CampaignDealStageActionType;
use MauticPlugin\DealFlowBundle\Form\Type\DashboardDealFlowWidgetType;
use MauticPlugin\DealFlowBundle\Form\Type\DealFieldType;
use MauticPlugin\DealFlowBundle\Form\Type\DealFlowConfigType;
use MauticPlugin\DealFlowBundle\Form\Type\DealTaskType;
use MauticPlugin\DealFlowBundle\Model\DealModel;
use MauticPlugin\DealFlowBundle\Security\Permissions\DealFlowPermissions;
use MauticPlugin\DealFlowBundle\Service\AttachmentStorage;
use MauticPlugin\DealFlowBundle\Service\AutomationOptionsProvider;
use MauticPlugin\DealFlowBundle\Service\DealAuthorization;
use MauticPlugin\DealFlowBundle\Service\DealContextBuilder;
use MauticPlugin\DealFlowBundle\Service\DealFieldManager;
use MauticPlugin\DealFlowBundle\Service\DealManager;
use MauticPlugin\DealFlowBundle\Service\DealTimelineBuilder;
use MauticPlugin\DealFlowBundle\Service\DefaultPipelineInitializer;
use MauticPlugin\DealFlowBundle\Service\IntegrityService;
use MauticPlugin\DealFlowBundle\Service\LicenseService;
use MauticPlugin\DealFlowBundle\Service\PipelineVelocityCalculator;
use MauticPlugin\DealFlowBundle\Service\UpdateService;

return [
    'name' => 'Deal Flow',
    'description' => 'Deal Flow sales pipeline plugin for Mautic.',
    'author' => 'FirmOptic',
    'version' => '0.9.4',
    'routes' => [
        'main' => [
            'mautic_dealflow_pipeline' => [
                'path' => '/deal-flow/pipeline',
                'controller' => DealController::class.'::pipelineAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_index' => [
                'path' => '/deal-flow/{page}',
                'controller' => DealController::class.'::indexAction',
                'defaults' => ['page' => 1],
                'requirements' => ['page' => '\d+'],
                'method' => 'GET',
            ],
            'mautic_dealflow_new' => [
                'path' => '/deal-flow/new',
                'controller' => DealController::class.'::newAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_view' => [
                'path' => '/deal-flow/view/{objectId}',
                'controller' => DealController::class.'::viewAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_edit' => [
                'path' => '/deal-flow/{objectId}/edit',
                'controller' => DealController::class.'::editAction',
                'method' => 'GET|POST',
            ],
            // @deprecated since v0.9.0. Old URL /deal-flow/edit/{id}. Use mautic_dealflow_edit (/deal-flow/{id}/edit) instead. Removal target: v1.0.0.
            'mautic_dealflow_edit_legacy' => [
                'path' => '/deal-flow/edit/{objectId}',
                'controller' => DealController::class.'::editAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_move_stage' => [
                'path' => '/deal-flow/{objectId}/stage',
                'controller' => DealController::class.'::moveStageAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_note_add' => [
                'path' => '/deal-flow/{objectId}/notes/add',
                'controller' => DealController::class.'::addNoteAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_note_edit' => [
                'path' => '/deal-flow/{objectId}/notes/{noteId}/edit',
                'controller' => DealController::class.'::editNoteAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_note_delete' => [
                'path' => '/deal-flow/{objectId}/notes/{noteId}/delete',
                'controller' => DealController::class.'::deleteNoteAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_task_add' => [
                'path' => '/deal-flow/{objectId}/tasks/add',
                'controller' => DealController::class.'::addTaskAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_task_complete' => [
                'path' => '/deal-flow/{objectId}/tasks/{taskId}/complete',
                'controller' => DealController::class.'::completeTaskAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_task_uncomplete' => [
                'path' => '/deal-flow/{objectId}/tasks/{taskId}/uncomplete',
                'controller' => DealController::class.'::uncompleteTaskAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_task_edit' => [
                'path' => '/deal-flow/{objectId}/tasks/{taskId}/edit',
                'controller' => DealController::class.'::editTaskAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_task_delete' => [
                'path' => '/deal-flow/{objectId}/tasks/{taskId}/delete',
                'controller' => DealController::class.'::deleteTaskAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_task_queue' => [
                'path' => '/deal-flow/tasks',
                'controller' => TaskController::class.'::queueAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_task_new' => [
                'path' => '/deal-flow/tasks/new',
                'controller' => TaskController::class.'::newAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_contact_attach' => [
                'path' => '/deal-flow/{objectId}/contacts/add',
                'controller' => DealController::class.'::associateContactAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_contact_detach' => [
                'path' => '/deal-flow/{objectId}/contact/{contactId}/detach',
                'controller' => DealController::class.'::detachContactAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_inline_edit' => [
                'path' => '/deal-flow/{objectId}/inline',
                'controller' => DealController::class.'::inlineEditAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_company_search' => [
                'path' => '/deal-flow/companies/search',
                'controller' => DealController::class.'::companySearchAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_csrf_token' => [
                'path' => '/dealflow/csrf-token',
                'controller' => DealController::class.'::csrfTokenAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_attachment_add' => [
                'path' => '/deal-flow/{objectId}/attachments/add',
                'controller' => DealController::class.'::addAttachmentAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_attachment_download' => [
                'path' => '/deal-flow/attachments/{attachmentId}/download',
                'controller' => DealController::class.'::downloadAttachmentAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_attachment_delete' => [
                'path' => '/deal-flow/{objectId}/attachments/{attachmentId}/delete',
                'controller' => DealController::class.'::deleteAttachmentAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_batch' => [
                'path' => '/deal-flow/batch',
                'controller' => DealController::class.'::batchAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_undo' => [
                'path' => '/deal-flow/undo',
                'controller' => DealController::class.'::undoBatchAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_reports' => [
                'path' => '/deal-flow/reports',
                'controller' => ReportController::class.'::indexAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_pipeline_settings_index' => [
                'path' => '/deal-flow/settings/pipelines',
                'controller' => PipelineController::class.'::indexAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_pipeline_settings_new' => [
                'path' => '/deal-flow/settings/pipelines/new',
                'controller' => PipelineController::class.'::newAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_pipeline_settings_edit' => [
                'path' => '/deal-flow/settings/pipelines/edit/{objectId}',
                'controller' => PipelineController::class.'::editAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_pipeline_settings_delete' => [
                'path' => '/deal-flow/settings/pipelines/delete/{objectId}',
                'controller' => PipelineController::class.'::deleteAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_stage_index' => [
                'path' => '/deal-flow/settings/stages',
                'controller' => StageController::class.'::indexAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_api_docs' => [
                'path' => '/deal-flow/settings/api-docs',
                'controller' => ApiDocsController::class.'::indexAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_inbound_webhook_index' => [
                'path' => '/deal-flow/settings/inbound-webhooks',
                'controller' => InboundWebhookSourceController::class.'::indexAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_inbound_webhook_new' => [
                'path' => '/deal-flow/settings/inbound-webhooks/new',
                'controller' => InboundWebhookSourceController::class.'::newAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_inbound_webhook_edit' => [
                'path' => '/deal-flow/settings/inbound-webhooks/edit/{objectId}',
                'controller' => InboundWebhookSourceController::class.'::editAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_inbound_webhook_delete' => [
                'path' => '/deal-flow/settings/inbound-webhooks/delete/{objectId}',
                'controller' => InboundWebhookSourceController::class.'::deleteAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_stage_new' => [
                'path' => '/deal-flow/settings/stages/new',
                'controller' => StageController::class.'::newAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_stage_edit' => [
                'path' => '/deal-flow/settings/stages/edit/{objectId}',
                'controller' => StageController::class.'::editAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_stage_move' => [
                'path' => '/deal-flow/settings/stages/{objectId}/move/{direction}',
                'controller' => StageController::class.'::moveAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_stage_delete' => [
                'path' => '/deal-flow/settings/stages/delete/{objectId}',
                'controller' => StageController::class.'::deleteAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_field_index' => [
                'path' => '/deal-flow/settings/fields',
                'controller' => DealFieldController::class.'::indexAction',
                'method' => 'GET',
            ],
            'mautic_dealflow_field_new' => [
                'path' => '/deal-flow/settings/fields/new',
                'controller' => DealFieldController::class.'::newAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_field_edit' => [
                'path' => '/deal-flow/settings/fields/edit/{objectId}',
                'controller' => DealFieldController::class.'::editAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_field_delete' => [
                'path' => '/deal-flow/settings/fields/delete/{objectId}',
                'controller' => DealFieldController::class.'::deleteAction',
                'method' => 'GET|POST',
            ],
            'mautic_dealflow_widget_config' => [
                'path' => '/dealflow/widget/config',
                'controller' => DashboardAjaxController::class.'::saveWidgetConfigAction',
                'method' => 'POST',
            ],
            'mautic_dealflow_update_check' => [
                'path' => '/deal-flow/settings/updates',
                'controller' => UpdateController::class.'::indexAction',
                'method' => 'GET',
            ],
        ],
        'api' => [
            'mautic_api_dealflow_deals' => [
                'path' => '/dealflow/deals',
                'controller' => DealApiController::class.'::listAction',
                'method' => 'GET|POST',
            ],
            'mautic_api_dealflow_deal' => [
                'path' => '/dealflow/deals/{id}',
                'controller' => DealApiController::class.'::detailAction',
                'method' => 'GET|PATCH',
            ],
            'mautic_api_dealflow_deal_stage' => [
                'path' => '/dealflow/deals/{id}/stage',
                'controller' => DealApiController::class.'::stageAction',
                'method' => 'POST',
            ],
            'mautic_api_dealflow_deal_contacts' => [
                'path' => '/dealflow/deals/{id}/contacts',
                'controller' => DealApiController::class.'::contactsAction',
                'method' => 'POST',
            ],
            'mautic_api_dealflow_deal_notes' => [
                'path' => '/dealflow/deals/{id}/notes',
                'controller' => DealApiController::class.'::notesAction',
                'method' => 'POST',
            ],
            'mautic_api_dealflow_deal_tasks' => [
                'path' => '/dealflow/deals/{id}/tasks',
                'controller' => DealApiController::class.'::tasksAction',
                'method' => 'POST',
            ],
            'mautic_api_dealflow_deal_task' => [
                'path' => '/dealflow/deals/{id}/tasks/{taskId}',
                'controller' => DealApiController::class.'::taskUpdateAction',
                'method' => 'PATCH',
            ],
            'mautic_api_dealflow_deal_attachment_from_form' => [
                'path' => '/dealflow/deals/{id}/attachments/from-form',
                'controller' => DealApiController::class.'::attachmentFromFormAction',
                'method' => 'POST',
            ],
            'mautic_api_dealflow_deal_attachments' => [
                'path' => '/dealflow/deals/{id}/attachments',
                'controller' => DealApiController::class.'::attachmentsAction',
                'method' => 'POST',
            ],
            'mautic_api_dealflow_deal_timeline' => [
                'path' => '/dealflow/deals/{id}/timeline',
                'controller' => DealApiController::class.'::timelineAction',
                'method' => 'GET',
            ],
            'mautic_api_dealflow_pipelines' => [
                'path' => '/dealflow/pipelines',
                'controller' => DealApiController::class.'::pipelinesAction',
                'method' => 'GET',
            ],
            'mautic_api_dealflow_pipeline_stages' => [
                'path' => '/dealflow/pipelines/{pipelineId}/stages',
                'controller' => DealApiController::class.'::pipelineStagesAction',
                'method' => 'GET',
            ],
        ],
        'public' => [
            'mautic_public_dealflow_webhook' => [
                'path' => '/dealflow/webhooks/inbound',
                'controller' => WebhookController::class.'::inboundAction',
                'method' => 'POST',
            ],
            'mautic_public_dealflow_webhook_source' => [
                'path' => '/dealflow/webhooks/inbound/{sourceKey}',
                'controller' => WebhookController::class.'::inboundAction',
                'method' => 'POST',
            ],
        ],
    ],
    'menu' => [
        'main' => [
            'dealflow.menu.root' => [
                'id' => 'mautic_dealflow_root',
                'iconClass' => 'ri-briefcase-4-fill',
                'access' => [
                    DealFlowPermissions::DEALS_VIEW_OWN,
                    DealFlowPermissions::DEALS_VIEW_OTHER,
                    DealFlowPermissions::DEALS_CREATE,
                    DealFlowPermissions::REPORTS_VIEW_OWN,
                    DealFlowPermissions::REPORTS_VIEW_OTHER,
                    DealFlowPermissions::SETTINGS_VIEW_OWN,
                    DealFlowPermissions::SETTINGS_VIEW_OTHER,
                ],
                'priority' => 74,
                'children' => [
                    'dealflow.menu.reports' => [
                        'id' => 'mautic_dealflow_reports',
                        'route' => 'mautic_dealflow_reports',
                        'access' => [DealFlowPermissions::REPORTS_VIEW_OWN, DealFlowPermissions::REPORTS_VIEW_OTHER],
                    ],
                    'dealflow.menu.pipeline' => [
                        'id' => 'mautic_dealflow_pipeline',
                        'route' => 'mautic_dealflow_pipeline',
                        'access' => [DealFlowPermissions::DEALS_VIEW_OWN, DealFlowPermissions::DEALS_VIEW_OTHER],
                    ],
                    'dealflow.menu.task_queue' => [
                        'id' => 'mautic_dealflow_task_queue',
                        'route' => 'mautic_dealflow_task_queue',
                        'access' => [DealFlowPermissions::DEALS_VIEW_OWN, DealFlowPermissions::DEALS_VIEW_OTHER],
                    ],
                    'dealflow.menu.pipelines' => [
                        'id' => 'mautic_dealflow_pipeline_settings_index',
                        'route' => 'mautic_dealflow_pipeline_settings_index',
                        'access' => [DealFlowPermissions::SETTINGS_VIEW_OWN, DealFlowPermissions::SETTINGS_VIEW_OTHER],
                    ],
                    'dealflow.menu.stages' => [
                        'id' => 'mautic_dealflow_stage_index',
                        'route' => 'mautic_dealflow_stage_index',
                        'access' => [DealFlowPermissions::SETTINGS_VIEW_OWN, DealFlowPermissions::SETTINGS_VIEW_OTHER],
                    ],
                    'dealflow.menu.custom_fields' => [
                        'id' => 'mautic_dealflow_field_index',
                        'route' => 'mautic_dealflow_field_index',
                        'access' => [DealFlowPermissions::SETTINGS_VIEW_OWN, DealFlowPermissions::SETTINGS_VIEW_OTHER],
                    ],
                    'dealflow.menu.inbound_webhooks' => [
                        'id' => 'mautic_dealflow_inbound_webhook_index',
                        'route' => 'mautic_dealflow_inbound_webhook_index',
                        'access' => [DealFlowPermissions::SETTINGS_VIEW_OWN, DealFlowPermissions::SETTINGS_VIEW_OTHER],
                    ],
                    'dealflow.menu.api_docs' => [
                        'id' => 'mautic_dealflow_api_docs',
                        'route' => 'mautic_dealflow_api_docs',
                        'access' => [DealFlowPermissions::SETTINGS_VIEW_OWN, DealFlowPermissions::SETTINGS_VIEW_OTHER],
                    ],
                    'dealflow.menu.updates' => [
                        'id' => 'mautic_dealflow_updates',
                        'route' => 'mautic_dealflow_update_check',
                        'access' => [DealFlowPermissions::SETTINGS_VIEW_OWN, DealFlowPermissions::SETTINGS_VIEW_OTHER],
                    ],
                ],
            ],
        ],
    ],
    'services' => [
        'events' => [
            'dealflow.deprecation_subscriber' => [
                'class' => DeprecationSubscriber::class,
                'arguments' => [
                    'monolog.logger.mautic',
                ],
                'tag' => 'kernel.event_subscriber',
            ],
            'dealflow.webhook_subscriber' => [
                'class' => WebhookSubscriber::class,
                'arguments' => [
                    'mautic.webhook.model.webhook',
                    'dealflow.service.context_builder',
                ],
            ],
            'dealflow.company_view_subscriber' => [
                'class' => CompanyViewSubscriber::class,
                'arguments' => [
                    'dealflow.repository.deal',
                    'dealflow.service.authorization',
                    'dealflow.service.context_builder',
                    'router',
                    'dealflow.service.license',
                ],
            ],
            'dealflow.contact_view_subscriber' => [
                'class' => ContactViewSubscriber::class,
                'arguments' => [
                    'dealflow.repository.deal_contact_association',
                    'dealflow.service.authorization',
                    'router',
                    'dealflow.service.license',
                ],
            ],
            'dealflow.config_subscriber' => [
                'class' => ConfigSubscriber::class,
                'arguments' => [
                    'dealflow.service.license',
                    'request_stack',
                    'dealflow.service.integrity',
                ],
            ],
            'dealflow.license_validation_subscriber' => [
                'class' => LicenseValidationSubscriber::class,
                'arguments' => [
                    'dealflow.service.license',
                    'request_stack',
                    'security.authorization_checker',
                ],
            ],
            'dealflow.license_route_guard' => [
                'class' => LicenseRouteGuard::class,
                'arguments' => [
                    'dealflow.service.license',
                    'router',
                ],
            ],
            'dealflow.license_menu_subscriber' => [
                'class' => LicenseMenuSubscriber::class,
                'arguments' => [
                    'dealflow.service.license',
                ],
            ],
            'dealflow.integration_config_subscriber' => [
                'class' => IntegrationConfigSubscriber::class,
                'arguments' => [
                    'dealflow.service.license',
                    'dealflow.service.integrity',
                    'mautic.helper.integration',
                    'request_stack',
                ],
            ],
            'dealflow.campaign_subscriber' => [
                'class' => CampaignSubscriber::class,
                'arguments' => [
                    'dealflow.repository.deal',
                    'dealflow.repository.stage',
                    'dealflow.service.manager',
                    'dealflow.repository.pipeline',
                    'dealflow.service.license',
                ],
            ],
            'dealflow.segment_subscriber' => [
                'class' => LeadListSubscriber::class,
                'arguments' => [
                    'dealflow.service.automation_options',
                    'mautic.lead.model.list',
                    'dealflow.service.license',
                ],
            ],
            'dealflow.contact_timeline_subscriber' => [
                'class' => ContactTimelineSubscriber::class,
                'arguments' => [
                    'dealflow.repository.deal_contact_association',
                    'translator',
                    'router',
                    'dealflow.service.license',
                ],
            ],
            'dealflow.dashboard_subscriber' => [
                'class' => DashboardSubscriber::class,
                'arguments' => [
                    'dealflow.repository.deal',
                    'dealflow.repository.task',
                    'dealflow.repository.pipeline',
                    'doctrine',
                    'dealflow.service.license',
                ],
            ],
            'dealflow.global_search_subscriber' => [
                'class' => GlobalSearchSubscriber::class,
                'arguments' => [
                    'dealflow.model.deal',
                    'mautic.security',
                    'dealflow.service.license',
                ],
                // GlobalSearch is injected via DealFlowBundle's compiler pass
                // when the core service exists. On older versions where the
                // service is absent, the compiler pass strips the setter call.
            ],
        ],
        'forms' => [
            'dealflow_config' => [
                'class' => DealFlowConfigType::class,
            ],
            'dealflow_campaign_match_condition' => [
                'class' => CampaignDealMatchConditionType::class,
                'arguments' => [
                    'dealflow.service.automation_options',
                ],
            ],
            'dealflow_campaign_stage_action' => [
                'class' => CampaignDealStageActionType::class,
                'arguments' => [
                    'dealflow.service.automation_options',
                ],
            ],
            'dealflow_campaign_create_action' => [
                'class' => CampaignDealCreateActionType::class,
                'arguments' => [
                    'dealflow.service.automation_options',
                ],
            ],
            'dealflow_field' => [
                'class' => DealFieldType::class,
            ],
            'dealflow_task' => [
                'class' => DealTaskType::class,
            ],
            'dealflow_dashboard_widget' => [
                'class' => DashboardDealFlowWidgetType::class,
                'arguments' => [
                    'dealflow.repository.pipeline',
                ],
            ],
        ],
        'models' => [
            'dealflow.model.deal' => [
                'class' => DealModel::class,
                'arguments' => [
                    'doctrine.orm.entity_manager',
                    'mautic.security',
                    'event_dispatcher',
                    'router',
                    'translator',
                    'mautic.helper.user',
                    'monolog.logger.mautic',
                    'mautic.helper.core_parameters',
                ],
                'methodCalls' => [
                    'setDealManager' => ['dealflow.service.manager'],
                    'setDealRepository' => ['dealflow.repository.deal'],
                ],
            ],
        ],
        'permissions' => [
            'dealflow.permissions' => [
                'class' => DealFlowPermissions::class,
                'arguments' => ['mautic.helper.core_parameters'],
            ],
        ],
        'controllers' => [
            // Sub-controllers consumed by DealController::forward() calls.
            // Only these need explicit registration — all other controllers
            // are auto-discovered by Mautic from the Controller/ directory.
            // Do NOT register DealController or other routed controllers here;
            // doing so creates duplicate definitions that break M5/M6.
            'dealflow.controller.deal_list' => [
                'class' => DealListController::class,
                'public' => true,
            ],
            'dealflow.controller.deal_form' => [
                'class' => DealFormController::class,
                'public' => true,
            ],
            'dealflow.controller.deal_view' => [
                'class' => DealViewController::class,
                'public' => true,
            ],
            'dealflow.controller.deal_view_ajax' => [
                'class' => DealViewAjaxController::class,
                'public' => true,
            ],
            'dealflow.controller.deal_batch' => [
                'class' => DealBatchController::class,
                'public' => true,
            ],
            'dealflow.controller.deal_attachment' => [
                'class' => DealAttachmentController::class,
                'public' => true,
            ],
        ],
        'other' => [
            'dealflow.repository.deal' => [
                'class' => DealRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.repository.stage' => [
                'class' => DealStageRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.repository.pipeline' => [
                'class' => PipelineRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.repository.deal_contact_association' => [
                'class' => DealContactAssociationRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.repository.field' => [
                'class' => DealFieldRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.repository.task' => [
                'class' => DealTaskRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.repository.deal_note' => [
                'class' => DealNoteRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.repository.deal_audit_event' => [
                'class' => DealAuditEventRepository::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.service.authorization' => [
                'class' => DealAuthorization::class,
                'arguments' => ['mautic.security', 'security.token_storage'],
            ],
            'dealflow.service.context_builder' => [
                'class' => DealContextBuilder::class,
                'arguments' => ['doctrine'],
            ],
            'dealflow.service.attachment_storage' => [
                'class' => AttachmentStorage::class,
                'arguments' => ['mautic.helper.core_parameters'],
            ],
            'dealflow.service.default_pipeline_initializer' => [
                'class' => DefaultPipelineInitializer::class,
                'arguments' => [
                    'doctrine.orm.entity_manager',
                    'dealflow.repository.pipeline',
                    'dealflow.repository.stage',
                    'mautic.helper.core_parameters',
                ],
            ],
            'dealflow.service.manager' => [
                'class' => DealManager::class,
                'arguments' => [
                    'doctrine.orm.entity_manager',
                    'dealflow.service.default_pipeline_initializer',
                    'dealflow.repository.stage',
                    'dealflow.service.attachment_storage',
                    'dealflow.service.field_manager',
                    'event_dispatcher',
                ],
            ],
            'dealflow.service.field_manager' => [
                'class' => DealFieldManager::class,
                'arguments' => [
                    'doctrine.orm.entity_manager',
                    'dealflow.repository.field',
                    'dealflow.repository.deal',
                ],
            ],
            'dealflow.service.velocity_calculator' => [
                'class' => PipelineVelocityCalculator::class,
                'arguments' => [
                    'dealflow.repository.deal_audit_event',
                    'dealflow.repository.deal',
                ],
            ],
            'dealflow.service.timeline_builder' => [
                'class' => DealTimelineBuilder::class,
                'arguments' => [
                    'dealflow.repository.deal_note',
                    'dealflow.repository.task',
                    'dealflow.repository.deal_audit_event',
                    'doctrine.orm.entity_manager',
                ],
            ],
            'dealflow.service.health_indicator' => [
                'class' => MauticPlugin\DealFlowBundle\Service\HealthIndicatorCalculator::class,
            ],
            'dealflow.service.automation_options' => [
                'class' => AutomationOptionsProvider::class,
                'arguments' => [
                    'dealflow.service.default_pipeline_initializer',
                    'dealflow.repository.deal',
                    'dealflow.repository.deal_contact_association',
                    'mautic.helper.core_parameters',
                ],
            ],
            'dealflow.service.license' => [
                'class' => LicenseService::class,
                'arguments' => [
                    'mautic.helper.core_parameters',
                    'mautic.cache.provider',
                    'monolog.logger.mautic',
                    'mautic.helper.integration',
                ],
                'methodCalls' => [
                    'setIntegrityService' => ['dealflow.service.integrity'],
                ],
            ],
            'dealflow.service.integrity' => [
                'class' => IntegrityService::class,
                'arguments' => [
                    'mautic.helper.core_parameters',
                    'monolog.logger.mautic',
                ],
            ],
            'dealflow.service.update' => [
                'class' => UpdateService::class,
                'arguments' => [
                    'dealflow.service.license',
                    'mautic.helper.core_parameters',
                    'mautic.cache.provider',
                    'monolog.logger.mautic',
                ],
            ],
            'dealflow.command.update' => [
                'class' => UpdateCommand::class,
                'arguments' => [
                    'dealflow.service.update',
                ],
                'tag' => 'console.command',
            ],
            'dealflow.compat.version_adapter' => [
                'class' => MauticVersionAdapter::class,
                'arguments' => [
                    'mautic.helper.app_version',
                ],
            ],
            'dealflow.compat.twig_extension' => [
                'class' => DealFlowCompatExtension::class,
                'arguments' => [
                    'dealflow.compat.version_adapter',
                ],
                'tag' => 'twig.extension',
            ],
        ],
    ],
    'parameters' => [
        'dealflow_upload_dir' => '%kernel.project_dir%/var/dealflow/uploads',
        'dealflow_max_attachment_size_mb' => 50,
        'dealflow_allowed_mime_types' => [
            'application/msword',
            'application/pdf',
            'application/vnd.ms-excel',
            'application/vnd.ms-powerpoint',
            'application/vnd.openxmlformats-officedocument.presentationml.presentation',
            'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'image/jpeg',
            'image/png',
        ],
        'dealflow_inbound_webhook_secret' => '',
        'dealflow_default_association_labels' => [
            'Decision Maker',
            'Billing Contact',
            'Champion',
            'Legal',
        ],
        'dealflow_default_sources' => [
            'Inbound marketing',
            'Outbound prospecting',
            'Referral',
            'Partner',
            'Event',
            'Website',
            'Existing customer',
            'Manual',
        ],
        'dealflow_default_stage_seed' => [
            ['name' => 'Identified', 'stage_type' => 'open', 'probability' => 10],
            ['name' => 'Prospect', 'stage_type' => 'open', 'probability' => 30],
            ['name' => 'Opportunity', 'stage_type' => 'open', 'probability' => 60],
            ['name' => 'Closed Won', 'stage_type' => 'won', 'probability' => 100],
            ['name' => 'Closed Lost', 'stage_type' => 'lost', 'probability' => 0],
        ],
        'dealflow_default_currency' => 'USD',
        'dealflow_items_per_page' => 30,
        'dealflow_health_yellow_days' => 7,
        'dealflow_health_red_days' => 14,
        'dealflow_default_task_priority' => 'normal',
        'dealflow_license_key' => '',
        'dealflow_license_status' => 'not_configured',
        'dealflow_license_updates_until' => '',
        'dealflow_license_last_validated_at' => '',
        'dealflow_license_last_validation_valid' => '',
        'dealflow_license_hash' => '',
        'dealflow_file_checksum' => '',
        'dealflow_license_api_url' => 'https://deal-flow-license-api-700460720657.us-east1.run.app',
    ],
];
