parameters:
    app.view.anonymize_exception: false

services:
    # Event Subscriber
    app.view.event_subscriber.cookie_setting:
        class: App\Service\View\EventSubscriber\CookieSettingEventSubscriber
        tags:
            - kernel.event_subscriber

    app.view.event_subscriver.exception_response_code_setting:
        class: App\Service\View\EventSubscriber\ExceptionResponseCodeSettingEventSubscriber
        tags:
            - kernel.event_subscriber

    app.view.event_subscriber.json_schema_builder:
        class: App\Service\View\EventSubscriber\JsonSchemaBuilderEventSubscriber
        tags:
            - kernel.event_subscriber

    app.view.event_subscriber.pagination_context_adding:
        class: App\Service\View\EventSubscriber\PaginationContextAddingEventSubscriber
        tags:
            - kernel.event_subscriber

    app.view.event_subscriber.total_items_adding:
        class: App\Service\View\EventSubscriber\TotalItemsAddingEventSubscriber
        tags:
            - kernel.event_subscriber

    # Serializer
    app.view.serializer.exception_normalizer.anonymizing:
        class: App\Service\View\Serializer\Exception\AnonymizingExceptionNormalizerDecorator
        decorates: app.view.serializer.exception_normalizer
        arguments:
            - '@.inner'
            - '%app.view.anonymize_exception%'

    app.view.serializer.exception_normalizer.constraint_violation:
        class: App\Service\View\Serializer\Exception\ConstraintViolationExceptionNormalizerDecorator
        decorates: app.view.serializer.exception_normalizer
        arguments:
            - '@.inner'

    app.view.serializer.exception_normalizer:
        class: App\Service\View\Serializer\Exception\ExceptionNormalizer
        tags:
            - serializer.normalizer

    app.view.serializer.exception_normalizer.http:
        class: App\Service\View\Serializer\Exception\HttpExceptionNormalizerDecorator
        decorates: app.view.serializer.exception_normalizer
        arguments:
            - '@.inner'

    app.view.serializer.exception_normalizer.partial_denormalization:
        class: App\Service\View\Serializer\Exception\PartialDenormalizationExceptionNormalizerDecorator
        decorates: app.view.serializer.exception_normalizer
        decoration_priority: 0
        arguments:
            - '@.inner'
            - '@translator'

    # View Handler
    app.view_handler.traceable:
        class: App\Service\View\TraceableViewHandlerDecorator
        decorates: app.view_handler
        decoration_priority: 200
        arguments:
            - '@.inner'
            - '@debug.stopwatch'

    app.view_handler:
        class: App\Service\View\ViewHandler
        arguments:
            - '@event_dispatcher'
            - '@serializer'

    App\Service\View\ViewHandlerInterface:
        alias: app.view_handler