services:
  _defaults:
    autowire: true
    autoconfigure: true

  # transformers
  XCart\Transformer\XLite\Model\Profile\Logic\Entity\Storefront\UserInterface: '@XCart\Transformer\XLite\Model\Profile\Logic\Entity\Storefront\User'
  XCart\Transformer\XLite\Model\Profile\Logic\Entity\Storefront\User:
    class: XCart\Transformer\XLite\Model\Profile\Logic\Entity\Storefront\User
    arguments:
      $factory: '@XCart\Factory\Logic\Entity\Storefront\UserInterface'
      $cartReadRepository: '@xcart.repository.cart.read'

  # get one
  xcart.logic.storefront.user.get_one.action.entity_id.assembler.decorator.get_self:
    class: XCart\Logic\Action\Storefront\User\GetOne\Assembler\EntityIdAssembler
    decorates: xcart.logic.storefront.user.get_one.action.entity_id.assembler
    arguments:
      $inner: '@.inner'

  # create one
  xcart.logic.storefront.user.create_one.action.decorator.validation.unique_login:
    class: XCart\Logic\Action\Storefront\User\Common\Decorator\UniqueLoginValidator
    decorates: xcart.logic.storefront.user.create_one.action
    arguments:
      $inner: '@.inner'
      $profileRepository: '@xcart.repository.profile.read'
      $responseAssembler: '@xcart.bundle.logic.decorator.validator.default_response_assembler'

  # update one
  xcart.logic.storefront.user.update_one.action.decorator.validation.unique_login:
    class: XCart\Logic\Action\Storefront\User\Common\Decorator\UniqueLoginValidator
    decorates: xcart.logic.storefront.user.update_one.action
    arguments:
      $inner: '@.inner'
      $profileRepository: '@xcart.repository.profile.read'
      $responseAssembler: '@xcart.bundle.logic.decorator.validator.default_response_assembler'

  xcart.logic.storefront.user.update_one.entity.enricher.decorator.update_self:
    class: XCart\Logic\Action\Storefront\User\UpdateOne\Enricher\TransparentEnricherDecorator
    decorates: xcart.logic.storefront.user.update_one.entity.enricher
    arguments:
      $inner: '@.inner'
