<?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>
        <!-- JSON Schema -->

        <service id="api_platform.hal.json_schema.schema_factory" class="ApiPlatform\Hal\JsonSchema\SchemaFactory" decorates="api_platform.json_schema.schema_factory">
            <argument type="service" id="api_platform.hal.json_schema.schema_factory.inner" />
        </service>

        <service id="api_platform.hal.encoder" class="ApiPlatform\Serializer\JsonEncoder" public="false">
            <argument>jsonhal</argument>

            <tag name="serializer.encoder" />
        </service>

        <service id="api_platform.hal.normalizer.entrypoint" class="ApiPlatform\Hal\Serializer\EntrypointNormalizer" public="false">
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
            <argument type="service" id="api_platform.iri_converter" />
            <argument type="service" id="api_platform.router" />

            <tag name="serializer.normalizer" priority="-800" />
        </service>

        <service id="api_platform.hal.normalizer.collection" class="ApiPlatform\Hal\Serializer\CollectionNormalizer" public="false">
            <argument type="service" id="api_platform.resource_class_resolver" />
            <argument>%api_platform.collection.pagination.page_parameter_name%</argument>
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />

            <!-- Run after api_platform.hal.normalizer.object but before serializer.normalizer.object and serializer.denormalizer.array -->
            <tag name="serializer.normalizer" priority="-985" />
        </service>

        <service id="api_platform.hal.normalizer.item" class="ApiPlatform\Hal\Serializer\ItemNormalizer" public="false">
            <argument type="service" id="api_platform.metadata.property.name_collection_factory" />
            <argument type="service" id="api_platform.metadata.property.metadata_factory" />
            <argument type="service" id="api_platform.iri_converter" />
            <argument type="service" id="api_platform.resource_class_resolver" />
            <argument type="service" id="api_platform.property_accessor" />
            <argument type="service" id="api_platform.name_converter" on-invalid="ignore" />
            <argument type="service" id="serializer.mapping.class_metadata_factory" on-invalid="ignore" />
            <argument type="collection" />
            <argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" on-invalid="ignore" />
            <argument type="service" id="api_platform.security.resource_access_checker" on-invalid="ignore" />
            <argument type="service" id="api_platform.http_cache.tag_collector" on-invalid="ignore" />

            <!-- Run before serializer.normalizer.json_serializable -->
            <tag name="serializer.normalizer" priority="-890" />
        </service>

        <service id="api_platform.hal.normalizer.object" class="ApiPlatform\Hal\Serializer\ObjectNormalizer" public="false">
            <argument type="service" id="serializer.normalizer.object" />
            <argument type="service" id="api_platform.iri_converter" />

            <!-- Run after serializer.denormalizer.array but before serializer.normalizer.object -->
            <tag name="serializer.normalizer" priority="-995" />
        </service>
    </services>

</container>
