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

dto_generator:
  entities:
    api:
      XCart\API\Entity\Storefront\VinLookup:
        name: Vin lookup
        logicEntity: XCart\Logic\Entity\Storefront\VinLookup
        path: /storefront/mmy/vin_lookup/{id}
        register_get_one: true
        idType: manual
        fields:
          id:
            type: string
            id: true
            nullable: true
            groups: [insert]
          vehicle:
            type: XCart\API\Entity\Storefront\Vehicle
            nullable: true
          error:
            type: string
            nullable: true
        annotations:
          - _: ApiResource
            itemOperations:
              get:
                method: GET
                path: /storefront/mmy/vin_lookup/{id}
                identifiers: []
                openapi_context:
                  summary: 'Retrieve a vehicle by vin number'
                  parameters:
                    - in: path
                      name: id
                      schema:
                        type: string
                      required: true
                      description: 'Vin number'
    logic:
      XCart\Logic\Entity\Storefront\VinLookup:
        generate_get_one: true
        idType: manual
        fields:
          id:
            type: string
            id: true
            nullable: true
          vehicle:
            type: XCart\Logic\Entity\Storefront\Vehicle
            nullable: true
          error:
            type: string
            nullable: true
    logic_request:
      XCart\Logic\Action\Storefront\VinLookup\GetOne\DTO\Request:
        type: get_one
        entity: XCart\Logic\Entity\Storefront\MmyLevel
        interfaces:
          - XC\VINLookup\Action\Storefront\VinLookup\GetOne\VinLookupRequestInterface
        traits:
          - XC\VINLookup\Action\Storefront\VinLookup\GetOne\VinLookupRequestTrait


services:
  _defaults:
    autowire: true
    autoconfigure: true

  XC\VINLookup\Core\Infra\FitmentsProviderFactory: ~
  XC\VINLookup\Core\FitmentsProvider:
    factory: ['@XC\VINLookup\Core\Infra\FitmentsProviderFactory', 'getProvider']
    public: true

  XC\VINLookup\Core\Infra\VehicleInfoProviderFactory: ~
  XC\VINLookup\Core\VehicleInfo\VehicleInfoProvider:
    factory: ['@XC\VINLookup\Core\Infra\VehicleInfoProviderFactory', 'getProvider']
    public: true

  XC\VINLookup\Core\VehicleInfo\Implementation\STUBVehicleInfoProvider:
    public: true
  XC\VINLookup\Core\VehicleInfo\Implementation\NHTSAVehicleInfoProvider:
    public: true

  XC\VINLookup\Core\VehicleInfo\Implementation\LoggedVehicleInfoProviderDecorator:
    decorates: XC\VINLookup\Core\VehicleInfo\VehicleInfoProvider
  XC\VINLookup\Core\LoggedFitmentsProviderDecorator:
    decorates: XC\VINLookup\Core\FitmentsProvider


  XC\VINLookup\Core\API\NHTSA\NHTSAProvider: ~
  XC\VINLookup\Core\Helper\FitmentsHelper:
    public: true

  # get one
  xcart.api.storefront.vinlookup.data_provider.item.request.assembler.decorator:
    class: XC\VINLookup\API\DataProvider\Storefront\Item\Assembler\RequestAssemblerDecorator
    decorates: xcart.api.storefront.vinlookup.data_provider.item.request.assembler
    arguments:
      $requestFactory: '@XCart\Factory\Logic\Action\Storefront\VinLookup\GetOne\DTO\RequestInterface'

  xcart.logic.storefront.vinlookup.get_one.action:
    class: XC\VINLookup\Action\Storefront\VinLookup\GetOne\Action
    arguments:
      $t: '@xcart.core.translation'
    tags:
      - {name: xcart.logic.action, request: \XCart\Logic\Action\Storefront\VinLookup\GetOne\DTO\Request, response: \XCart\Logic\Action\Storefront\VinLookup\GetOne\DTO\Response}
