services:
    oro_attachment.api.attachment_association_provider:
        class: Oro\Bundle\AttachmentBundle\Api\AttachmentAssociationProvider
        arguments:
            - '@oro_api.doctrine_helper'
            - '@oro_attachment.association_helper'

    oro_attachment.api.get_config.add_attachment_associations:
        class: Oro\Bundle\AttachmentBundle\Api\Processor\AddAttachmentAssociations
        arguments:
            - '@oro_attachment.api.attachment_association_provider'
        tags:
            - { name: oro.api.processor, action: get_config, extra: '!identifier_fields_only', priority: -10 }

    oro_attachment.api.get_config.add_attachment_association_descriptions:
        class: Oro\Bundle\AttachmentBundle\Api\Processor\AddAttachmentAssociationDescriptions
        arguments:
            - '@oro_attachment.api.attachment_association_provider'
            - '@oro_api.complete_descriptions.resource_doc_parser_provider'
            - '@oro_api.entity_name_provider'
        tags:
            - { name: oro.api.processor, action: get_config, extra: descriptions, priority: -208 }

    oro_attachment.api.collect_subresources.exclude_change_attachment_subresources:
        class: Oro\Bundle\AttachmentBundle\Api\Processor\ExcludeChangeAttachmentSubresources
        arguments:
            - '@oro_attachment.api.attachment_association_provider'
        tags:
            - { name: oro.api.processor, action: collect_subresources, priority: -20 }

    oro_attachment.api.compute_file_content:
        class: Oro\Bundle\AttachmentBundle\Api\Processor\ComputeFileContent
        arguments:
            - '@oro_attachment.file_manager'
            - '@logger'
        tags:
            - { name: oro.api.processor, action: customize_loaded_data, class: Oro\Bundle\AttachmentBundle\Entity\File }
            - { name: monolog.logger, channel: api }

    oro_attachment.api.add_file_content_form_listener:
        class: Oro\Bundle\AttachmentBundle\Api\Processor\AddFileContentFormListener
        arguments:
            - '@oro_attachment.file_manager'
        tags:
            - { name: oro.api.processor, action: create, group: transform_data, class: Oro\Bundle\AttachmentBundle\Entity\File, priority: 90 }
            - { name: oro.api.processor, action: update, group: transform_data, class: Oro\Bundle\AttachmentBundle\Entity\File, priority: 90 }

    oro_attachment.api.handle_external_url:
        class: Oro\Bundle\AttachmentBundle\Api\Processor\HandleExternalUrl
        arguments:
            - '@oro_attachment.tools.external_file_factory'
            - '@oro_attachment.validator.file_config_validator'
            - '@translator'
        tags:
            - { name: oro.api.processor, action: customize_form_data, event: pre_submit|post_validate, class: Oro\Bundle\AttachmentBundle\Entity\File }

    oro_attachment.api.validate_file_view_access:
        class: Oro\Bundle\AttachmentBundle\Api\Processor\ValidateFileViewAccess
        arguments:
            - '@security.authorization_checker'
        tags:
            - { name: oro.api.processor, action: get, group: data_security_check, class: Oro\Bundle\AttachmentBundle\Entity\File, priority: 10 }
