services:
  _defaults:
    autowire: true
    autoconfigure: true

  # decorators

  ## cart

  #### create one
  XCart\Logic\Action\Storefront\Cart\CreateOne\UniqueCartActionDecorator:
    class: XCart\Logic\Action\Storefront\Cart\CreateOne\UniqueCartActionDecorator
    decorates: xcart.logic.storefront.cart.create_one.action
    arguments:
      $inner: '@.inner'
      $cartReadRepository: '@xcart.repository.cart.read'
      $responseAssembler: '@xcart.logic.storefront.cart.create_one.response.assembler'

  XCart\Logic\Action\Storefront\Cart\CreateOne\Assembler\CalculationResponseAssemblerDecorator.create_one:
    class: XCart\Logic\Action\Storefront\Cart\CreateOne\Assembler\CalculationResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.create_one.response.assembler
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $writeRepository: '@xcart.repository.cart.write'

  XCart\Logic\Action\Storefront\Cart\CreateOne\Assembler\EntityAssemblerDecorator.create_one:
    class: XCart\Logic\Action\Storefront\Cart\CreateOne\Assembler\EntityAssemblerDecorator
    decorates: xcart.logic.storefront.cart.create_one.entity.assembler
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $profileRepository: '@xcart.repository.profile.write'

  XCart\Logic\Action\Storefront\Cart\GetOne\Assembler\ResponseAssemblerDecorator.create_one:
    class: XCart\Logic\Action\Storefront\Cart\GetOne\Assembler\ResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.create_one.response.assembler
    decoration_priority: 50
    arguments:
      $inner: '@.inner'

  #### update one
  XCart\Logic\Action\Storefront\Cart\UpdateOne\Enricher\CalculationEnricherDecorator.update_one:
    class: XCart\Logic\Action\Storefront\Cart\UpdateOne\Enricher\CalculationEnricherDecorator
    decorates: xcart.logic.storefront.cart.update_one.entity.enricher
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $writeRepository: '@xcart.repository.cart.write'

  XCart\Logic\Action\Storefront\Cart\GetOne\Assembler\ResponseAssemblerDecorator.update_one:
    class: XCart\Logic\Action\Storefront\Cart\GetOne\Assembler\ResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.update_one.response.assembler
    decoration_priority: 50
    arguments:
      $inner: '@.inner'

  ### get one
  XCart\Logic\Action\Storefront\Cart\GetOne\RenewCartActionDecorator:
    class: XCart\Logic\Action\Storefront\Cart\GetOne\RenewCartActionDecorator
    decorates: xcart.logic.storefront.cart.get_one.action
    arguments:
      $inner: '@.inner'
      $entityIdAssembler: '@xcart.logic.storefront.cart.get_one.action.entity_id.assembler'
      $cartWriteDataSource: '@xcart.data_source.cart.write'

  XCart\Logic\Action\Storefront\Cart\GetOne\Assembler\ResponseAssemblerDecorator.get_one:
    class: XCart\Logic\Action\Storefront\Cart\GetOne\Assembler\ResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.get_one.response.assembler
    decoration_priority: 50
    arguments:
      $inner: '@.inner'

  ### delete one
  xcart.logic.storefront.cart.delete_one.arguments.assembler:
    class: XCart\Bundle\DoctrineBridgeBundle\Assembler\DeleteOne\Arguments\IdBasedArgumentsAssembler
    arguments:
      '$idFieldName': 'order_id'

  ## cart item

  #### create one
  XCart\Logic\Action\Storefront\CartItem\Common\Assembler\CalculationResponseAssemblerDecorator.create_one:
    class: XCart\Logic\Action\Storefront\CartItem\Common\Assembler\CalculationResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.item.create_one.response.assembler
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $writeRepository: '@xcart.repository.cart.write'

  XCart\Logic\Action\Storefront\CartItem\CreateOne\Assembler\ResponseAssemblerDecorator:
    class: XCart\Logic\Action\Storefront\CartItem\CreateOne\Assembler\ResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.item.create_one.response.assembler
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $cartWriteRepository: '@xcart.repository.cart.write'

  XCart\Logic\Action\Storefront\CartItem\GetOne\Assembler\ResponseAssemblerDecorator.create_one:
    class: XCart\Logic\Action\Storefront\CartItem\GetOne\Assembler\ResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.item.create_one.response.assembler
    decoration_priority: 50
    arguments:
      $inner: '@.inner'

  XCart\Logic\Action\Storefront\CartItem\Common\Assembler\ModelAttributeValuesAssemblerInterface: '@XCart\Logic\Action\Storefront\CartItem\Common\Assembler\ModelAttributeValuesAssembler'
  XCart\Logic\Action\Storefront\CartItem\Common\Assembler\ModelAttributeValuesAssembler:
    class: XCart\Logic\Action\Storefront\CartItem\Common\Assembler\ModelAttributeValuesAssembler

  #### update one
  XCart\Logic\Action\Storefront\CartItem\Common\Assembler\CalculationResponseAssemblerDecorator.update_one:
    class: XCart\Logic\Action\Storefront\CartItem\Common\Assembler\CalculationResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.item.update_one.response.assembler
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $writeRepository: '@xcart.repository.cart.write'

  XCart\Logic\Action\Storefront\CartItem\UpdateOne\Enricher\AttributeValuesEnricherDecorator:
    class: XCart\Logic\Action\Storefront\CartItem\UpdateOne\Enricher\AttributeValuesEnricherDecorator
    decorates: xcart.logic.storefront.cart.item.update_one.entity.enricher
    arguments:
      $inner: '@.inner'

  XCart\Logic\Action\Storefront\CartItem\GetOne\Assembler\ResponseAssemblerDecorator.update_one:
    class: XCart\Logic\Action\Storefront\CartItem\GetOne\Assembler\ResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.item.update_one.response.assembler
    decoration_priority: 50
    arguments:
      $inner: '@.inner'

  #### delete one
  XCart\Logic\Action\Storefront\CartItem\DeleteOne\Assembler\CalculationResponseAssemblerDecorator:
    class: XCart\Logic\Action\Storefront\CartItem\DeleteOne\Assembler\CalculationResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.item.delete_one.response.assembler
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $writeRepository: '@xcart.repository.cart.write'

  ### get one
  XCart\Logic\Action\Storefront\CartItem\GetOne\Assembler\ResponseAssemblerDecorator.get_one:
    class: XCart\Logic\Action\Storefront\CartItem\GetOne\Assembler\ResponseAssemblerDecorator
    decorates: xcart.logic.storefront.cart.item.get_one.response.assembler
    decoration_priority: 50
    arguments:
      $inner: '@.inner'

  ## cart merge
  xcart.logic.storefront.cart.mergerequest.create_one.action:
    class: XCart\Logic\Action\Storefront\CartMerge\CreateOne\Action
    arguments:
      $cartWriteRepository: '@xcart.repository.cart.write'
      $profileWriteRepository: '@xcart.repository.profile.write'

  ## calculated shipping rates
  xcart.logic.storefront.cart.calculatedshippingrates.create_one.action:
    class: XCart\Logic\Action\Storefront\CartCalculatedShippingRates\CreateOne\Action
    arguments:
      $cartReadRepository: '@xcart.repository.cart.read'

  xcart.logic.storefront.cart.calculatedshippingrates.create_one.action.decorator.set_default_shipping_method:
    class: XCart\Logic\Action\Storefront\CartCalculatedShippingRates\CreateOne\SetDefaultShippingMethodActionDecorator
    decorates: xcart.logic.storefront.cart.calculatedshippingrates.create_one.action
    decoration_priority: 40
    arguments:
      $inner: '@.inner'
      $cartReadRepository: '@xcart.repository.cart.read'

  ## shipping method selection
  xcart.logic.storefront.cart.shippingmethodselection.create_one.action:
    class: XCart\Logic\Action\Storefront\ShippingMethodSelection\CreateOne\Action
    arguments:
      $cartWriteRepository: '@xcart.repository.cart.write'

  ## payment method selection
  xcart.logic.storefront.cart.paymentmethodselection.create_one.action:
    class: XCart\Logic\Action\Storefront\PaymentMethodSelection\CreateOne\Action
    arguments:
      $cartWriteRepository: '@xcart.repository.cart.write'

  ## payment method get list
  xcart.logic.storefront.cart.paymentmethod.get_collection.action:
    class: XCart\Logic\Action\Storefront\PaymentMethod\GetCollection\Action
    arguments:
      $responseFactory: '@xcart.logic.storefront.cart.paymentmethod.get_collection.action.factory.response'
    tags:
      - {name: xcart.logic.action, request: XCart\Logic\Action\Storefront\Cart\PaymentMethod\GetList\DTO\Request, response: XCart\Logic\Action\Storefront\Cart\PaymentMethod\GetList\DTO\Response}

  ## payment method get one
  xcart.logic.storefront.cart.paymentmethod.get_one.action:
    class: XCart\Logic\Action\Storefront\PaymentMethod\GetOne\Action
    arguments:
      $responseFactory: '@xcart.logic.storefront.cart.paymentmethod.get_one.action.factory.response'
    tags:
      - {name: xcart.logic.action, request: XCart\Logic\Action\Storefront\Cart\PaymentMethod\GetOne\DTO\Request, response: XCart\Logic\Action\Storefront\Cart\PaymentMethod\GetOne\DTO\Response}

  ## cart email change
  xcart.logic.storefront.cart.emailchanging.create_one.action:
    class: XCart\Logic\Action\Storefront\CartEmailChanging\CreateOne\Action
    arguments:
      $cartWriteRepository: '@xcart.repository.cart.write'

  ## order
  xcart.logic.storefront.order.create_one.action:
    class: XCart\Logic\Action\Storefront\Order\CreateOne\Action
    arguments:
      $cartWriteRepository: '@xcart.repository.cart.write'
      $shippingMethodReadRepository: '@xcart.repository.shipping_method.read'
