<?xml version="1.0" encoding="utf-8" ?>
<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">

    <parameters>

        <!-- Utility classes -->

        <parameter key="liip_imagine.filter.configuration.class">Liip\ImagineBundle\Imagine\Filter\FilterConfiguration</parameter>
        <parameter key="liip_imagine.filter.manager.class">Liip\ImagineBundle\Imagine\Filter\FilterManager</parameter>
        <parameter key="liip_imagine.data.manager.class">Liip\ImagineBundle\Imagine\Data\DataManager</parameter>
        <parameter key="liip_imagine.cache.manager.class">Liip\ImagineBundle\Imagine\Cache\CacheManager</parameter>
        <parameter key="liip_imagine.binary.mime_type_guesser.class">Liip\ImagineBundle\Binary\SimpleMimeTypeGuesser</parameter>

        <!-- Controller class -->

        <parameter key="liip_imagine.controller.class">Liip\ImagineBundle\Controller\ImagineController</parameter>

        <!-- Route loader class -->

        <parameter key="liip_imagine.routing.loader.class">Liip\ImagineBundle\Routing\ImagineLoader</parameter>

        <!-- Templating classes -->

        <parameter key="liip_imagine.twig.extension.class">Liip\ImagineBundle\Templating\ImagineExtension</parameter>
        <parameter key="liip_imagine.templating.helper.class">Liip\ImagineBundle\Templating\Helper\ImagineHelper</parameter>

        <!-- ImagineInterface implementations -->

        <parameter key="liip_imagine.gd.class">Imagine\Gd\Imagine</parameter>
        <parameter key="liip_imagine.imagick.class">Imagine\Imagick\Imagine</parameter>
        <parameter key="liip_imagine.gmagick.class">Imagine\Gmagick\Imagine</parameter>

        <!-- Filter loaders' classes -->

        <parameter key="liip_imagine.filter.loader.relative_resize.class">Liip\ImagineBundle\Imagine\Filter\Loader\RelativeResizeFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.resize.class">Liip\ImagineBundle\Imagine\Filter\Loader\ResizeFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.thumbnail.class">Liip\ImagineBundle\Imagine\Filter\Loader\ThumbnailFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.crop.class">Liip\ImagineBundle\Imagine\Filter\Loader\CropFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.paste.class">Liip\ImagineBundle\Imagine\Filter\Loader\PasteFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.watermark.class">Liip\ImagineBundle\Imagine\Filter\Loader\WatermarkFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.strip.class">Liip\ImagineBundle\Imagine\Filter\Loader\StripFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.background.class">Liip\ImagineBundle\Imagine\Filter\Loader\BackgroundFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.upscale.class">Liip\ImagineBundle\Imagine\Filter\Loader\UpscaleFilterLoader</parameter>
        <parameter key="liip_imagine.filter.loader.auto_rotate.class">Liip\ImagineBundle\Imagine\Filter\Loader\AutoRotateFilterLoader</parameter>

        <!-- Data loaders' classes -->

        <parameter key="liip_imagine.binary.loader.filesystem.class">Liip\ImagineBundle\Binary\Loader\FileSystemLoader</parameter>
        <parameter key="liip_imagine.binary.loader.stream.class">Liip\ImagineBundle\Binary\Loader\StreamLoader</parameter>

        <!-- Cache resolvers' classes -->

        <parameter key="liip_imagine.cache.resolver.web_path.class">Liip\ImagineBundle\Imagine\Cache\Resolver\WebPathResolver</parameter>
        <parameter key="liip_imagine.cache.resolver.no_cache_web_path.class">Liip\ImagineBundle\Imagine\Cache\Resolver\NoCacheWebPathResolver</parameter>
        <parameter key="liip_imagine.cache.resolver.aws_s3.class">Liip\ImagineBundle\Imagine\Cache\Resolver\AwsS3Resolver</parameter>
        <parameter key="liip_imagine.cache.resolver.cache.class">Liip\ImagineBundle\Imagine\Cache\Resolver\CacheResolver</parameter>
        <parameter key="liip_imagine.cache.resolver.proxy.class">Liip\ImagineBundle\Imagine\Cache\Resolver\ProxyResolver</parameter>

        <!-- Form types -->

        <parameter key="liip_imagine.form.type.image.class">Liip\ImagineBundle\Form\Type\ImageType</parameter>

    </parameters>

    <services>

        <!-- Utility services -->

        <service id="liip_imagine.filter.manager" class="%liip_imagine.filter.manager.class%">
            <argument type="service" id="liip_imagine.filter.configuration" />
            <argument type="service" id="liip_imagine" />
        </service>

        <service id="liip_imagine.data.manager" class="%liip_imagine.data.manager.class%">
            <argument type="service" id="liip_imagine.binary.mime_type_guesser" />
            <argument type="service" id="liip_imagine.extension_guesser" />
            <argument type="service" id="liip_imagine.filter.configuration" />
            <argument>%liip_imagine.binary.loader.default%</argument>
        </service>

        <service id="liip_imagine.cache.manager" class="%liip_imagine.cache.manager.class%">
            <argument type="service" id="liip_imagine.filter.configuration" />
            <argument type="service" id="router" />
            <argument type="service" id="liip_imagine.uri_signer" />
            <argument type="service" id="event_dispatcher" />
            <argument>%liip_imagine.cache.resolver.default%</argument>
        </service>

        <service id="liip_imagine.filter.configuration" class="%liip_imagine.filter.configuration.class%">
            <argument>%liip_imagine.filter_sets%</argument>
        </service>

        <!-- Controller -->

        <service id="liip_imagine.controller" class="%liip_imagine.controller.class%">
            <argument type="service" id="liip_imagine.data.manager" />
            <argument type="service" id="liip_imagine.filter.manager" />
            <argument type="service" id="liip_imagine.cache.manager" />
            <argument type="service" id="liip_imagine.uri_signer" />
        </service>

        <!-- Route Loader -->

        <service id="liip_imagine.routing.loader" class="%liip_imagine.routing.loader.class%">
            <tag name="routing.loader" />
            <argument type="service" id="liip_imagine.filter.configuration" />
            <argument>%liip_imagine.controller_action%</argument>
            <argument>%liip_imagine.cache_prefix%</argument>
        </service>

        <!-- ImagineInterface instances -->

        <service id="liip_imagine" alias="liip_imagine.gd" />

        <service id="liip_imagine.gd" class="%liip_imagine.gd.class%" public="false" />

        <service id="liip_imagine.imagick" class="%liip_imagine.imagick.class%" public="false" />

        <service id="liip_imagine.gmagick" class="%liip_imagine.gmagick.class%" public="false" />

        <!--  Templating helpers and extensions -->

        <service id="liip_imagine.twig.extension" class="%liip_imagine.twig.extension.class%" public="false">
            <tag name="twig.extension" />
            <argument type="service" id="liip_imagine.cache.manager" />
        </service>

        <service id="liip_imagine.templating.helper" class="%liip_imagine.templating.helper.class%">
            <tag name="templating.helper" alias="imagine" />
            <argument type="service" id="liip_imagine.cache.manager" />
        </service>

        <!-- Filter loaders -->

        <service id="liip_imagine.filter.loader.relative_resize" class="%liip_imagine.filter.loader.relative_resize.class%">
            <tag name="liip_imagine.filter.loader" loader="relative_resize" />
        </service>

        <service id="liip_imagine.filter.loader.resize" class="%liip_imagine.filter.loader.resize.class%">
            <tag name="liip_imagine.filter.loader" loader="resize" />
        </service>

        <service id="liip_imagine.filter.loader.thumbnail" class="%liip_imagine.filter.loader.thumbnail.class%">
            <tag name="liip_imagine.filter.loader" loader="thumbnail" />
        </service>

        <service id="liip_imagine.filter.loader.crop" class="%liip_imagine.filter.loader.crop.class%">
            <tag name="liip_imagine.filter.loader" loader="crop" />
        </service>

        <service id="liip_imagine.filter.loader.paste" class="%liip_imagine.filter.loader.paste.class%">
            <tag name="liip_imagine.filter.loader" loader="paste" />
            <argument type="service" id="liip_imagine" />
            <argument>%kernel.root_dir%</argument>
        </service>

        <service id="liip_imagine.filter.loader.watermark" class="%liip_imagine.filter.loader.watermark.class%">
            <tag name="liip_imagine.filter.loader" loader="watermark" />
            <argument type="service" id="liip_imagine" />
            <argument>%kernel.root_dir%</argument>
        </service>

        <service id="liip_imagine.filter.loader.background" class="%liip_imagine.filter.loader.background.class%">
            <tag name="liip_imagine.filter.loader" loader="background" />
            <argument type="service" id="liip_imagine" />
        </service>

        <service id="liip_imagine.filter.loader.strip" class="%liip_imagine.filter.loader.strip.class%">
            <tag name="liip_imagine.filter.loader" loader="strip" />
        </service>

        <service id="liip_imagine.filter.loader.upscale" class="%liip_imagine.filter.loader.upscale.class%">
            <tag name="liip_imagine.filter.loader" loader="upscale" />
        </service>

        <service id="liip_imagine.filter.loader.auto_rotate" class="%liip_imagine.filter.loader.auto_rotate.class%">
            <tag name="liip_imagine.filter.loader" loader="auto_rotate" />
        </service>

        <!-- Data loaders -->

        <service id="liip_imagine.binary.loader.prototype.filesystem" class="%liip_imagine.binary.loader.filesystem.class%">
            <argument type="service" id="liip_imagine.mime_type_guesser" />
            <argument type="service" id="liip_imagine.extension_guesser" />
            <argument><!-- will be injected by FileSystemLoaderFactory --></argument>
        </service>

        <service id="liip_imagine.binary.loader.prototype.stream" class="%liip_imagine.binary.loader.stream.class%">
            <argument><!-- will be injected by StreamLoaderFactory --></argument>
            <argument><!-- will be injected by StreamLoaderFactory --></argument>
        </service>

        <!-- Cache resolver -->

        <service id="liip_imagine.cache.resolver.prototype.web_path" class="%liip_imagine.cache.resolver.web_path.class%" public="true" abstract="true">
            <argument type="service" id="filesystem" />
            <argument type="service" id="router.request_context" />
            <argument><!-- will be injected by WebPathResolverFactory --></argument>
            <argument><!-- will be injected by WebPathResolverFactory --></argument>
        </service>

        <service id="liip_imagine.cache.resolver.prototype.aws_s3" class="%liip_imagine.cache.resolver.aws_s3.class%" public="true" abstract="true">
            <argument><!-- will be injected by AwsS3ResolverFactory --></argument>
            <argument><!-- will be injected by AwsS3ResolverFactory --></argument>
            <argument><!-- will be injected by AwsS3ResolverFactory --></argument>
            <argument><!-- will be injected by AwsS3ResolverFactory --></argument>
        </service>

        <service id="liip_imagine.cache.resolver.prototype.cache" class="%liip_imagine.cache.resolver.cache.class%" public="true" abstract="true">
            <argument><!-- will be injected by a ResolverFactory --></argument>
            <argument><!-- will be injected by a ResolverFactory --></argument>
        </service>

        <service id="liip_imagine.cache.resolver.prototype.proxy" class="%liip_imagine.cache.resolver.proxy.class%" public="true" abstract="true">
            <argument><!-- will be injected by AwsS3ResolverFactory --></argument>
            <argument><!-- will be injected by AwsS3ResolverFactory --></argument>
        </service>

        <service id="liip_imagine.cache.resolver.no_cache_web_path" class="%liip_imagine.cache.resolver.no_cache_web_path.class%" public="true">
            <argument type="service" id="router.request_context" />
            <tag name="liip_imagine.cache.resolver" resolver="no_cache" />
        </service>

        <!-- Form types -->

        <service id="liip_imagine.form.type.image" class="%liip_imagine.form.type.image.class%">
            <tag name="form.type" alias="liip_imagine_image" />
        </service>

        <!-- Guessers -->

        <service
            id="liip_imagine.mime_type_guesser"
            class="Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface"
            factory-class="Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser"
            factory-method="getInstance"
        />

        <service
            id="liip_imagine.extension_guesser"
            class="Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface"
            factory-class="Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"
            factory-method="getInstance"
        />

        <service id="liip_imagine.binary.mime_type_guesser" class="%liip_imagine.binary.mime_type_guesser.class%">
            <argument type="service" id="liip_imagine.mime_type_guesser" />
        </service>

        <service id="liip_imagine.uri_signer" alias="uri_signer" />
    </services>
</container>
