<?php

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

use IvyForms\Services\Menu\MenuManager;
use IvyForms\Services\Menu\MenuMapper;
use IvyForms\Services\Menu\MenuService;
use IvyForms\Services\Integrations\PluginInstaller;
use IvyForms\Services\Integrations\IntegrationRegistry;
use IvyForms\Services\Integrations\IntegrationService;
use IvyForms\Controllers\Integrations\InstallPluginController;
use IvyForms\Controllers\Integration\GetAllIntegrationsController;
use IvyForms\Controllers\Integration\GetIntegrationController;
use IvyForms\Controllers\Form\ExportFormController;
use IvyForms\Controllers\Form\ImportFormController;
use IvyForms\Services\Form\FormService;
use IvyForms\Services\Form\FormImportExportService;
use IvyForms\Services\Field\FieldService;
use IvyForms\Services\Notification\NotificationService;
use IvyForms\Services\Confirmation\ConfirmationService;
use IvyForms\Services\Submission\SubmissionDataFormatterService;

return [

    MenuManager::class => function () {
        return new MenuManager(
            new MenuService(),
            new MenuMapper()
        );
    },

    PluginInstaller::class => function () {
        return new PluginInstaller();
    },

    InstallPluginController::class => function ($container) {
        return new InstallPluginController(
            $container->get(PluginInstaller::class)
        );
    },

    IntegrationRegistry::class => function () {
        return new IntegrationRegistry();
    },

    IntegrationService::class => function ($container) {
        return new IntegrationService(
            $container->get(IntegrationRegistry::class)
        );
    },
    SubmissionDataFormatterService::class => function () {
        return new SubmissionDataFormatterService();
    },

    FormImportExportService::class => function ($container) {
        return new FormImportExportService(
            $container->get(FormService::class),
            $container->get(FieldService::class),
            $container->get(NotificationService::class),
            $container->get(ConfirmationService::class)
        );
    },

    ExportFormController::class => function ($container) {
        return new ExportFormController(
            $container->get(FormImportExportService::class)
        );
    },

    ImportFormController::class => function ($container) {
        return new ImportFormController(
            $container->get(FormImportExportService::class)
        );
    },

//    GetAllIntegrationsController::class => function ($container) {
//        return new GetAllIntegrationsController(
//            $container->get(IntegrationRegistry::class)
//        );
//    },
//
//    GetIntegrationController::class => function ($container) {
//        return new GetIntegrationController(
//            $container->get(IntegrationRegistry::class)
//        );
//    },
];
