<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="Shopware\Core\Framework\Routing\RequestTransformerInterface"
                 class="Shopware\Core\Framework\Routing\RequestTransformer"
                 public="true"/>

        <service id="Shopware\Core\Framework\Api\Controller\FallbackController" public="true">
            <call method="setContainer">
                <argument type="service" id="service_container" />
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\EventListener\CorsListener">
            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Core\Framework\Api\EventListener\ResponseExceptionListener">
            <tag name="kernel.event_subscriber"/>
            <argument>%kernel.debug%</argument>
        </service>

        <service id="Shopware\Core\Framework\Api\EventListener\ResponseHeaderListener">
            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Context\ContextValueResolver">
            <tag name="controller.argument_value_resolver" priority="1000"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\AccessKeyController" public="true">
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\ApiController" public="true">
            <argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\DefinitionInstanceRegistry"/>
            <argument type="service" id="serializer"/>
            <argument type="service" id="api.request_criteria_builder"/>
            <argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\EntityProtection\EntityProtectionValidator"/>
            <argument type="service" id="Shopware\Core\Framework\Api\Acl\AclCriteriaValidator"/>
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\SyncController" public="true">
            <argument type="service" id="Shopware\Core\Framework\Api\Sync\SyncService"/>
            <argument type="service" id="serializer"/>
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\HealthCheckController" public="true">
            <argument type="service" id="event_dispatcher"/>
            <argument type="service" id="Shopware\Core\Framework\SystemCheck\SystemChecker"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\IndexingController" public="true">
            <argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexerRegistry"/>
            <argument type="service" id="messenger.default_bus"/>
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Command\DumpSchemaCommand">
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\DefinitionService"/>
            <argument type="service" id="cache.object"/>

            <tag name="console.command"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Command\DumpClassSchemaCommand">
            <tag name="console.command"/>
            <argument>%kernel.bundles_metadata%</argument>
        </service>

        <service id="Shopware\Core\Framework\Api\Command\CreateIntegrationCommand">
            <tag name="console.command"/>

            <argument type="service" id="integration.repository"/>
        </service>

        <!-- Serializer -->
        <service id="Shopware\Core\Framework\Api\Serializer\JsonApiDecoder">
            <tag name="serializer.encoder"/>
        </service>

        <!-- Response types -->
        <service id="Shopware\Core\Framework\Api\Response\ResponseFactoryRegistry">
            <argument type="service" id="Shopware\Core\Framework\Api\Response\Type\Api\JsonApiType"/>
            <!-- deactivated, the current sales channel api design does not match the json api requirements -->
            <argument type="service" id="Shopware\Core\Framework\Api\Response\Type\Api\JsonType"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Response\Type\Api\JsonApiType">
            <argument type="service" id="Shopware\Core\Framework\Api\Serializer\JsonApiEncoder"/>
            <argument type="service" id="Shopware\Core\System\SalesChannel\Api\StructEncoder"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Serializer\JsonApiEncoder"/>

        <service id="Shopware\Core\Framework\Api\Serializer\JsonEntityEncoder">
            <argument type="service" id="serializer"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Response\Type\Api\JsonType">
            <argument type="service" id="Shopware\Core\Framework\Api\Serializer\JsonEntityEncoder"/>
            <argument type="service" id="Shopware\Core\System\SalesChannel\Api\StructEncoder"/>
        </service>

        <!-- API Docs -->
        <service id="Shopware\Core\Framework\Api\ApiDefinition\DefinitionService">
            <argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\DefinitionInstanceRegistry"/>
            <argument type="service" id="Shopware\Core\System\SalesChannel\Entity\SalesChannelDefinitionInstanceRegistry"/>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\StoreApiGenerator"/>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi3Generator"/>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\EntitySchemaGenerator"/>
        </service>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiDefinitionSchemaBuilder"/>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiPathBuilder"/>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiSchemaBuilder">
            <argument>%kernel.shopware_version%</argument>
        </service>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\BundleSchemaPathCollection">
            <argument type="service" id="kernel.bundles"/>
        </service>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi3Generator">
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiSchemaBuilder"/>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiPathBuilder"/>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiDefinitionSchemaBuilder"/>
            <argument>%kernel.bundles_metadata%</argument>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\BundleSchemaPathCollection"/>
        </service>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\StoreApiGenerator">
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiSchemaBuilder"/>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\OpenApi\OpenApiDefinitionSchemaBuilder"/>
            <argument>%kernel.bundles_metadata%</argument>
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\BundleSchemaPathCollection"/>
        </service>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\EntitySchemaGenerator">
        </service>

        <service id="Shopware\Core\Framework\Api\ApiDefinition\Generator\CachedEntitySchemaGenerator" decorates="Shopware\Core\Framework\Api\ApiDefinition\Generator\EntitySchemaGenerator">
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\Generator\CachedEntitySchemaGenerator.inner"/>
            <argument type="service" id="cache.object"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\InfoController" public="true">
            <argument type="service" id="Shopware\Core\Framework\Api\ApiDefinition\DefinitionService"/>
            <argument type="service" id="parameter_bag"/>
            <argument type="service" id="kernel" />
            <argument type="service" id="Shopware\Core\Framework\Event\BusinessEventCollector" />
            <argument type="service" id="shopware.increment.gateway.registry"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware\Core\Maintenance\System\Service\AppUrlVerifier"/>
            <argument type="service" id="router"/>
            <argument type="service" id="Shopware\Core\Content\Flow\Api\FlowActionCollector"/>
            <argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService"/>
            <argument type="service" id="Shopware\Core\Framework\Api\Route\ApiRouteInfoResolver"/>
            <argument type="service" id="Shopware\Core\Framework\Store\InAppPurchase"/>
            <argument type="service" id="Shopware\Administration\Framework\Twig\ViteFileAccessorDecorator" on-invalid="null"/>
            <argument type="service" id="filesystem"/>
            <argument type="service" id="Shopware\Core\Framework\App\ShopId\ShopIdProvider"/>
            <argument type="service" id="Shopware\Core\Framework\MessageQueue\Stats\StatsService"/>

            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\AuthController" public="true">
            <argument type="service" id="shopware.api.authorization_server"/>
            <argument type="service" id="Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory"/>
            <argument type="service" id="shopware.rate_limiter"/>
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\CacheController" public="true">
            <argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheClearer"/>
            <argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheInvalidator"/>
            <argument type="service" id="cache.object"/>
            <argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexerRegistry"/>
            <tag name="container.service_subscriber" />
            <tag name="controller.service_arguments" />
            <call method="setContainer">
                <argument type="service" id="Psr\Container\ContainerInterface" />
            </call>
        </service>

        <!-- API OAuth Repositories -->
        <service id="Shopware\Core\Framework\Api\OAuth\AccessTokenRepository"/>
        <service id="Shopware\Core\Framework\Api\OAuth\ClientRepository">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>
        <service id="Shopware\Core\Framework\Api\OAuth\RefreshTokenRepository">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>

        <service id="Shopware\Core\Framework\Api\OAuth\ScopeRepository">
            <argument type="tagged_iterator" tag="shopware.oauth.scope"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>

        <service id="Shopware\Core\Framework\Api\OAuth\UserRepository">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware\Administration\Login\Config\LoginConfigService"/>
        </service>

        <!-- Scopes -->
        <service id="Shopware\Core\Framework\Api\OAuth\Scope\WriteScope">
            <tag name="shopware.oauth.scope"/>
        </service>

        <service id="Shopware\Core\Framework\Api\OAuth\Scope\AdminScope">
            <tag name="shopware.oauth.scope"/>
        </service>

        <service id="Shopware\Core\Framework\Api\OAuth\Scope\UserVerifiedScope">
            <tag name="shopware.oauth.scope"/>
        </service>

        <!-- API -->
        <service id="shopware.jwt_config" class="Lcobucci\JWT\Configuration">
            <factory class="Shopware\Core\Framework\Api\OAuth\JWTConfigurationFactory"
                     method="createJWTConfiguration"/>
        </service>


        <service id="Shopware\Core\Framework\Api\OAuth\FakeCryptKey">
            <argument type="service" id="shopware.jwt_config"/>
        </service>

        <service class="League\OAuth2\Server\AuthorizationServer" id="shopware.api.authorization_server">
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\ClientRepository"/>
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\AccessTokenRepository"/>
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\ScopeRepository"/>
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\FakeCryptKey"/>
            <argument>%env(APP_SECRET)%</argument>
        </service>

        <service id="Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory"/>

        <service id="Shopware\Core\Framework\Api\OAuth\SymfonyBearerTokenValidator">
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\AccessTokenRepository"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="shopware.jwt_config"/>
        </service>

        <!-- Events -->
        <service id="Shopware\Core\Framework\Api\EventListener\JsonRequestTransformerListener">
            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Core\Framework\Api\EventListener\ExpectationSubscriber">
            <argument>%kernel.shopware_version%</argument>
            <argument>%kernel.plugin_infos%</argument>
            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Core\Framework\Api\EventListener\Authentication\SalesChannelAuthenticationListener">
            <tag name="kernel.event_subscriber"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware\Core\Framework\Routing\RouteScopeRegistry"/>
            <argument type="service" id="Shopware\Core\Framework\Routing\MaintenanceModeResolver"/>
        </service>

        <service id="Shopware\Core\Framework\Api\EventListener\Authentication\ApiAuthenticationListener">
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\SymfonyBearerTokenValidator"/>
            <argument type="service" id="shopware.api.authorization_server"/>
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\UserRepository"/>
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\RefreshTokenRepository"/>
            <argument type="service" id="Shopware\Core\Framework\Routing\RouteScopeRegistry"/>
            <argument type="service" id="Shopware\Administration\Login\UserService\UserService"/>
            <argument type="service" id="Shopware\Administration\Login\TokenService\ExternalTokenService"/>
            <argument type="string">%shopware.api.access_token_ttl%</argument>
            <argument type="string">%shopware.api.refresh_token_ttl%</argument>

            <tag name="kernel.event_subscriber"/>
        </service>

        <service id="Shopware\Core\Framework\Api\EventListener\Authentication\UserCredentialsChangedSubscriber">
            <tag name="kernel.event_subscriber"/>
            <argument type="service" id="Shopware\Core\Framework\Api\OAuth\RefreshTokenRepository"/>
            <argument type="service" id="Doctrine\DBAL\Connection"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\UserController" public="true">
            <argument type="service" id="user.repository"/>
            <argument type="service" id="acl_user_role.repository"/>
            <argument type="service" id="acl_role.repository"/>
            <argument type="service" id="user_access_key.repository"/>
            <argument type="service" id="Shopware\Core\System\User\UserDefinition"/>
            <argument type="service" id="Shopware\Core\Framework\Sso\SsoService"/>
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\IntegrationController" public="true">
            <argument type="service" id="integration.repository"/>
            <call method="setContainer">
                <argument type="service" id="service_container"/>
            </call>
        </service>

        <service id="Shopware\Core\Framework\Api\Response\ResponseFactoryInterfaceValueResolver">
            <tag name="controller.argument_value_resolver" priority="50"/>
            <argument type="service" id="Shopware\Core\Framework\Api\Response\ResponseFactoryRegistry"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Route\ApiRouteLoader">
            <argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\DefinitionInstanceRegistry"/>
            <tag name="routing.loader"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Route\ApiRouteInfoResolver">
            <argument type="service" id="router.default" />
        </service>

        <service id="Shopware\Core\Framework\Validation\DataValidator">
            <argument type="service" id="validator"/>
        </service>

        <service id="Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory">
            <argument type="service" id="Nyholm\Psr7\Factory\Psr17Factory"/>
            <argument type="service" id="Nyholm\Psr7\Factory\Psr17Factory"/>
            <argument type="service" id="Nyholm\Psr7\Factory\Psr17Factory"/>
            <argument type="service" id="Nyholm\Psr7\Factory\Psr17Factory"/>
        </service>

        <service id="Nyholm\Psr7\Factory\Psr17Factory"/>

        <service id="Shopware\Core\Framework\Validation\HappyPathValidator" decorates="validator">
            <argument type="service" id="Shopware\Core\Framework\Validation\HappyPathValidator.inner"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\CustomSnippetFormatController" public="true">
            <argument type="service" id="Shopware\Core\Framework\Plugin\KernelPluginCollection" />
            <argument type="service" id="twig"/>
        </service>

        <service id="Shopware\Core\Framework\Api\Controller\FeatureFlagController" public="true">
            <argument type="service" id="Shopware\Core\Framework\Feature\FeatureFlagRegistry"/>
            <argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheClearer"/>
        </service>
    </services>
</container>
