services:
  _defaults:
    autowire: true
    autoconfigure: true

  xcart.api.storefront.payment.action.data_persister:
    class: XCart\Bundle\APIPlatformBridgeBundle\API\DataPersister\DataPersister
    arguments:
      $classes: ['XCart\API\Entity\Storefront\Payment\Action']
      $persister: '@xcart.api.storefront.payment.action.data_persister.persister'

  #  # Uncomment when problem with persister will be fixed (ECOM-2928)
  #  xcart.api.storefront.payment.action.data_persister.persister:
  #    class: XCart\Bundle\APIPlatformBridgeBundle\API\DataPersister\Persister\Persister
  #    arguments:
  #      $addAction:
  #      $updateAction: '@xcart.logic.storefront.payment.action.update_one.action'
  #      $addRequestAssembler:
  #      $updateRequestAssembler: '@xcart.api.storefront.payment.action.data_persister.persister.request.assembler.update'

  # Remove when problem with persister will be fixed (ECOM-2928)
  xcart.api.storefront.payment.action.data_persister.persister:
    class: XCart\API\Endpoint\Storefront\Payment\Action\DataPersister\Persister
    arguments:
      $addAction:
      $updateAction: '@xcart.logic.storefront.payment.action.update_one.action'
      $addRequestAssembler:
      $updateRequestAssembler: '@xcart.api.storefront.payment.action.data_persister.persister.request.assembler.update'
      $responseAssembler: '@xcart.api.storefront.payment.action.data_provider.item.response.assembler'

  XCart\API\Endpoint\Storefront\Payment\Action\DataProvider\Item\Assembler\ResponseAssembler\AccessDecorator:
    decorates: xcart.api.storefront.payment.action.data_provider.item.response.assembler
    arguments:
      $inner: '@.inner'

  XCart\API\Endpoint\Storefront\Payment\Action\DataProvider\Item\Assembler\RequestAssemblerDecorator:
    decorates: xcart.api.storefront.payment.action.data_provider.item.request.assembler
    arguments:
      $inner: '@.inner'

  XCart\API\Endpoint\Storefront\Payment\Action\DataPersister\Persister\Assembler\CreatePayloadAssemblerDecorator:
    decorates: xcart.api.storefront.payment.action.data_persister.persister.request.assembler.update
    arguments:
      $inner: '@.inner'

  XCart\API\Endpoint\Storefront\Payment\Action\SubIriConverter\SubIriConverter:
    class: XCart\API\Endpoint\Storefront\Payment\Action\SubIriConverter\SubIriConverter
    tags:
      - xcart.api.sub_iri_from_item_converter
