services:
  _defaults:
    autowire: true
    autoconfigure: true

  # get address field list
  xcart.doctrine.storefront.addressfield.criteria.assembler.decorator.enabled:
    class: XCart\Logic\Action\Storefront\AddressField\GetList\Assembler\Criteria\FindListCriteriaAssemblerDecorator
    decorates: xcart.doctrine.storefront.addressfield.criteria.assembler
    decoration_priority: 10
    arguments:
      $inner: '@.inner'

  # get one address
  xcart.logic.storefront.address.get_one.action.self:
    class: XCart\Logic\Action\Storefront\Address\GetOne\Action
    arguments:
      $readRepository: '@xcart.repository.address.read'
      $responseAssembler: '@xcart.logic.storefront.address.get_one.response.assembler'
    tags:
      - {name: xcart.logic.action, request: XCart\Logic\Action\Storefront\Address\GetOne\DTO\Request, response: XCart\Logic\Action\Storefront\Address\GetOne\DTO\Response}

  # create one address
  xcart.logic.storefront.address.create_one.action.decorator.check_auth:
    class: XCart\Logic\Action\Storefront\Address\CreateOne\Action\CheckAuthDecorator
    decorates: xcart.logic.storefront.address.create_one.action
    decoration_priority: 5
    arguments:
      $inner: '@.inner'

  XCart\Transformer\Logic\Entity\Storefront\NewAddress\XLite\Model\AddressInterface: '@XCart\Transformer\Logic\Entity\Storefront\NewAddress\XLite\Model\Address'
  XCart\Transformer\Logic\Entity\Storefront\NewAddress\XLite\Model\Address:
    class: XCart\Transformer\Logic\Entity\Storefront\NewAddress\XLite\Model\Address
    arguments:
      $profileRepository: '@xcart.repository.profile.read'
      $setAddressFields: '@XCart\Operation\Service\Storefront\Address\SetAddressFields'

  # update one address
  xcart.logic.storefront.address.update_one.action.decorator.correct_other_addresses:
    class: XCart\Logic\Action\Storefront\Address\UpdateOne\ActionDecorator
    decorates: xcart.logic.storefront.address.update_one.action
    decoration_priority: 100
    arguments:
      $inner: '@.inner'
      $profileRepository: '@xcart.repository.profile.read'

  xcart.logic.storefront.address.update_one.entity.enricher.internal.decorator.self:
    class: XCart\Logic\Action\Storefront\Address\UpdateOne\Enricher\Transparent\WalkingTransparentEnricherDecorator
    decorates: xcart.logic.storefront.address.update_one.entity.enricher.internal
    arguments:
      $inner: '@.inner'
      $setAddressFields: '@XCart\Operation\Service\Storefront\Address\SetAddressFields'

  # get one address field
  xcart.logic.storefront.address_field.get_one.action:
    class: XCart\Logic\Action\Storefront\AddressField\GetOne\Action
    arguments:
      $readRepository: '@xcart.repository.addressfield.read'
      $responseAssembler: '@xcart.logic.storefront.addressfield.get_one.response.assembler'
    tags:
      - {name: xcart.logic.action, request: XCart\Logic\Action\Storefront\AddressField\GetOne\DTO\Request, response: XCart\Logic\Action\Storefront\AddressField\GetOne\DTO\Response}
