#
# Module services
#
# Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
# See https://www.x-cart.com/license-agreement.html for license details.

api_platform:
  resource_class_directories:
    - '%kernel.project_dir%/var/run/classes/QSL/ProductStickers/Model'

dto_generator:
  entities:
    dto:
      XCart\API\Entity\Storefront\Sticker:
        fields:
          label:
            type: string
          textColor:
            type: string
          bgColor:
            type: string
      XCart\Logic\Entity\Storefront\Sticker:
        fields:
          label:
            type: string
          textColor:
            type: string
          bgColor:
            type: string
    api:
      XCart\API\Entity\Storefront\Product\Compact:
        fields:
          stickers:
            type: XCart\API\Entity\Storefront\Sticker[]

      XCart\API\Entity\Storefront\Product\Detailed:
        fields:
          stickers:
            type: XCart\API\Entity\Storefront\Sticker[]

    logic:
      XCart\Logic\Entity\Storefront\Product:
        fields:
          stickers:
            type: XCart\Logic\Entity\Storefront\Sticker[]

services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: true

  xcart.repository.qsl.product_sticker.product_sticker:
    class: XLite\Model\Repo\CleanURL
    factory: ['@doctrine.orm.default_entity_manager', getRepository]
    arguments:
      - QSL\ProductStickers\Model\ProductSticker


  # /product_stickers
  QSL\ProductStickers\API\Endpoint\ProductSticker\Transformer\OutputTransformerInterface: '@QSL\ProductStickers\API\Endpoint\ProductSticker\Transformer\OutputTransformer'
  QSL\ProductStickers\API\Endpoint\ProductSticker\Transformer\OutputTransformer: ~
  QSL\ProductStickers\API\Endpoint\ProductSticker\Transformer\InputTransformerInterface: '@QSL\ProductStickers\API\Endpoint\ProductSticker\Transformer\InputTransformer'
  QSL\ProductStickers\API\Endpoint\ProductSticker\Transformer\InputTransformer:
    arguments:
      $repository: '@xcart.repository.qsl.product_sticker.product_sticker'

  xcart.api.qsl.product_stickers.product_sticker.controller:
    class: QSL\ProductStickers\Controller\API\ProductSticker\Post

  QSL\ProductStickers\API\OpenApiTagsRepositoryDecorator:
    decorates: XLite\API\OpenApiTagsRepository

  QSL\ProductStickers\API\Endpoint\ProductSticker\SubExtension\SubExtension:
    tags: [!php/const XLite\API\Extension\ItemSubExtension\ItemSubExtensionInterface::ITEM_SUB_EXTENSION_TAG, !php/const XLite\API\Extension\CollectionSubExtension\CollectionSubExtensionInterface::COLLECTION_SUB_EXTENSION_TAG]

  QSL\ProductStickers\Transformer\XLite\Model\Product\Logic\Entity\Storefront\ProductDecorator:
    decorates: XCart\Transformer\XLite\Model\Product\Logic\Entity\Storefront\Product
