services:
    # Import processors
    oro_zendesk.importexport.processor.import_abstract:
        abstract: true
        calls:
             - [setConnectorContextMediator, ['@oro_integration.provider.connector_context_mediator']]
             - [setLogger, ['@oro_integration.logger.strategy']]
             - [setContextRegistry, ['@oro_importexport.context_registry']]

    oro_zendesk.importexport.processor.import_user:
        parent: oro_zendesk.importexport.processor.import_abstract
        class: Oro\Bundle\ZendeskBundle\ImportExport\Processor\ImportUserProcessor
        arguments:
            - '@oro_zendesk.sync_helper.user'

    oro_zendesk.importexport.processor.import_ticket:
        parent: oro_zendesk.importexport.processor.import_abstract
        class: Oro\Bundle\ZendeskBundle\ImportExport\Processor\ImportTicketProcessor
        arguments:
            - '@oro_zendesk.sync_helper.ticket'
            - '@oro_zendesk.sync_state'
            - '@oro_zendesk.entity_provider.oro'

    oro_zendesk.importexport.processor.import_ticket_comment:
        parent: oro_zendesk.importexport.processor.import_abstract
        class: Oro\Bundle\ZendeskBundle\ImportExport\Processor\ImportTicketCommentProcessor
        arguments:
            - '@oro_zendesk.sync_helper.ticket_comment'

    # Export processors
    oro_zendesk.importexport.processor.export_abstract:
        abstract: true
        calls:
             - [setConnectorContextMediator, ['@oro_integration.provider.connector_context_mediator']]
             - [setLogger, ['@oro_integration.logger.strategy']]
             - [setZendeskProvider, ['@oro_zendesk.entity_provider.zendesk']]
             - [setContextRegistry, ['@oro_importexport.context_registry']]

    oro_zendesk.importexport.processor.export_ticket:
        parent: oro_zendesk.importexport.processor.export_abstract
        class: Oro\Bundle\ZendeskBundle\ImportExport\Processor\ExportTicketProcessor
        arguments:
            - '@oro_zendesk.transport.rest_transport'
            - '@oro_zendesk.sync_helper.ticket'
            - '@oro_zendesk.entity_mapper'

    oro_zendesk.importexport.processor.export_ticket_comment:
        parent: oro_zendesk.importexport.processor.export_abstract
        class: Oro\Bundle\ZendeskBundle\ImportExport\Processor\ExportTicketCommentProcessor

    # Normalizers
    oro_zendesk.importexport.normalizer.user:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Serializer\Normalizer\UserNormalizer
        tags:
            - { name: oro_importexport.normalizer }

    oro_zendesk.importexport.normalizer.user_role:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Serializer\Normalizer\UserRoleNormalizer
        tags:
            - { name: oro_importexport.normalizer }

    oro_zendesk.importexport.normalizer.ticket:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Serializer\Normalizer\TicketNormalizer
        tags:
            - { name: oro_importexport.normalizer }

    oro_zendesk.importexport.normalizer.ticket_status:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Serializer\Normalizer\TicketStatusNormalizer
        tags:
            - { name: oro_importexport.normalizer }

    oro_zendesk.importexport.normalizer.ticket_priority:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Serializer\Normalizer\TicketPriorityNormalizer
        tags:
            - { name: oro_importexport.normalizer }

    oro_zendesk.importexport.normalizer.ticket_type:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Serializer\Normalizer\TicketTypeNormalizer
        tags:
            - { name: oro_importexport.normalizer }

    oro_zendesk.importexport.normalizer.ticket_comment:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Serializer\Normalizer\TicketCommentNormalizer
        tags:
            - { name: oro_importexport.normalizer }

    # Integration type
    oro_zendesk.provider.channel_type:
        class: Oro\Bundle\ZendeskBundle\Provider\ChannelType
        tags:
            - { name: oro_integration.channel, type: zendesk }

    # Connectors
    oro_zendesk.zendesk.user_connector:
        class: Oro\Bundle\ZendeskBundle\Provider\UserConnector
        arguments:
          - '@oro_zendesk.sync_state'
          - '@oro_importexport.context_registry'
          - '@oro_integration.logger.strategy'
          - '@oro_integration.provider.connector_context_mediator'
        tags:
          - { name: oro_integration.connector, type: user, channel_type: zendesk }

    oro_zendesk.zendesk.ticket_connector:
        class: Oro\Bundle\ZendeskBundle\Provider\TicketConnector
        arguments:
          - '@oro_zendesk.sync_state'
          - '@oro_importexport.context_registry'
          - '@oro_integration.logger.strategy'
          - '@oro_integration.provider.connector_context_mediator'
        tags:
          - { name: oro_integration.connector, type: ticket, channel_type: zendesk }

    oro_zendesk.zendesk.ticket_comment_connector:
        class: Oro\Bundle\ZendeskBundle\Provider\TicketCommentConnector
        arguments:
          - '@oro_zendesk.sync_state'
          - '@oro_importexport.context_registry'
          - '@oro_integration.logger.strategy'
          - '@oro_integration.provider.connector_context_mediator'
        tags:
          - { name: oro_integration.connector, type: ticket_comment, channel_type: zendesk }

    # Writers
    oro_zendesk.importexport.writer.export_abstract:
        abstract: true
        calls:
            - [setRegistry, ['@doctrine']]
            - [setTransport, ['@oro_zendesk.transport.rest_transport']]
            - [setConnectorContextMediator, ['@oro_integration.provider.connector_context_mediator']]
            - [setContextRegistry, ['@oro_importexport.context_registry']]
            - [setUserHelper, ['@oro_zendesk.sync_helper.user']]
            - [setLogger, ['@oro_integration.logger.strategy']]

    oro_zendesk.importexport.writer.export_ticket:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Writer\TicketExportWriter
        parent: oro_zendesk.importexport.writer.export_abstract
        arguments:
            - '@oro_integration.sync_scheduler'
            - '@oro_zendesk.sync_helper.ticket'
            - '@oro_zendesk.sync_helper.ticket_comment'

    oro_zendesk.importexport.writer.export_ticket_comment:
        class: Oro\Bundle\ZendeskBundle\ImportExport\Writer\TicketCommentExportWriter
        parent: oro_zendesk.importexport.writer.export_abstract
        arguments:
            - '@oro_zendesk.sync_helper.ticket_comment'
            - '@oro_zendesk.handler.ticket_comment_exception'

