services:
    akeneo_connectivity.connection.service.client.create_client:
        class: Akeneo\Connectivity\Connection\Infrastructure\Client\Fos\CreateClient
        arguments:
            - '@fos_oauth_server.client_manager.default'

    akeneo_connectivity.connection.service.client.delete_client:
        class: Akeneo\Connectivity\Connection\Infrastructure\Client\Fos\DeleteClient
        arguments:
            - '@fos_oauth_server.client_manager.default'

    akeneo_connectivity.connection.service.user.create_user:
        class: Akeneo\Connectivity\Connection\Infrastructure\User\Internal\CreateUser
        arguments:
            - '@pim_user.factory.user'
            - '@pim_user.updater.user'
            - '@validator'
            - '@pim_user.saver.user'

    akeneo_connectivity.connection.service.user.delete_user:
        class: Akeneo\Connectivity\Connection\Infrastructure\User\Internal\DeleteUser
        arguments:
            - '@pim_user.repository.user'
            - '@pim_user.remover.user'

    Akeneo\Connectivity\Connection\Infrastructure\User\Internal\DeleteUserGroup:
        arguments:
            - '@pim_user.repository.group'
            - '@pim_user.remover.user_group'

    Akeneo\Connectivity\Connection\Infrastructure\User\Internal\DeleteUserRole:
        arguments:
            - '@pim_user.repository.role'
            - '@pim_user.remover.role'

    akeneo_connectivity.connection.service.client.regenerate_client_secret:
        class: Akeneo\Connectivity\Connection\Infrastructure\Client\Fos\FosRegenerateClientSecret
        arguments:
            - '@fos_oauth_server.client_manager.default'
            - '@database_connection'

    akeneo_connectivity.connection.service.user.regenerate_user_password:
        class: Akeneo\Connectivity\Connection\Infrastructure\User\Internal\RegenerateUserPassword
        arguments:
            - '@pim_user.manager'
            - '@database_connection'

    akeneo_connectivity.connection.service.user.update_user_permissions:
        class: Akeneo\Connectivity\Connection\Infrastructure\User\Internal\UpdateUserPermissions
        arguments:
            - '@pim_user.manager'
            - '@pim_user.repository.role'
            - '@pim_user.repository.group'
            - '@pim_user.updater.user'

    akeneo_connectivity.connection.service.file_info.does_image_exist:
        class: Akeneo\Connectivity\Connection\Infrastructure\FileInfo\Internal\DoesImageExistQuery
        arguments:
            - '@database_connection'

    akeneo_connectivity.connection.service.connection_context:
        class: Akeneo\Connectivity\Connection\Infrastructure\ConnectionContext
        arguments:
            - '@akeneo_connectivity.connection.persistence.query.are_credentials_valid_combination'
            - '@akeneo_connectivity.connection.persistence.query.select_connection_code_by_client_id'
            - '@akeneo_connectivity.connection.persistence.repository.connection'

    akeneo_connectivity.connection.error_management.service.collect_api_error:
        class: Akeneo\Connectivity\Connection\Application\ErrorManagement\Service\CollectApiError
        arguments:
            - '@akeneo_connectivity.connection.service.connection_context'
            - '@akeneo_connectivity.connection.persistence.repository.business_error'
            - '@akeneo_connectivity.connection.application.error_management.handler.update_connection_error_count'
            - '@akeneo_connectivity.connection.exception_serializer'

    akeneo_connectivity.connection.webhook.service.url_reachability_checker:
        class: Akeneo\Connectivity\Connection\Infrastructure\Webhook\Service\WebhookReachabilityChecker
        arguments:
            - '@akeneo_connectivity.connection.webhook.guzzle_client'
            - '@validator'

    akeneo_connectivity.connection.webhook.generate_secret:
        class: Akeneo\Connectivity\Connection\Infrastructure\Webhook\GenerateSecret

    akeneo_connectivity.connection.webhook.cache_clearer:
        class: Akeneo\Connectivity\Connection\Infrastructure\Webhook\Service\CacheClearer
        arguments:
            - '@pim_connector.doctrine.cache_clearer'
            - '@akeneo.pim.storage_utils.cache.cached_queries_clearer'

    akeneo_connectivity.connection.webhook.get_delay_until_next_request:
        class: Akeneo\Connectivity\Connection\Infrastructure\Webhook\Service\GetDelayUntilNextRequest
        arguments:
            - '@akeneo_connectivity.connection.persistence.query.select_events_api_request_count_within_last_hour_query'

    akeneo_connectivity.connection.webhook.sleep:
        class: Akeneo\Connectivity\Connection\Infrastructure\Webhook\Service\Sleep

    akeneo_connectivity.connection.clock:
        class: Akeneo\Connectivity\Connection\Infrastructure\Service\Clock\SystemClock

    akeneo_connectivity.connection.encrypter:
        class: Akeneo\Connectivity\Connection\Infrastructure\Service\Encrypter
        arguments:
            - 'AES-256-OFB'
            - '%env(APP_SECRET)%'
            - '%env(APP_SECRET)%'

    akeneo_connectivity.connection.dns_lookup:
        class: Akeneo\Connectivity\Connection\Infrastructure\Service\DnsLookup

    akeneo_connectivity.connection.ip_matcher:
        class: Akeneo\Connectivity\Connection\Infrastructure\Service\IpMatcher
