services:
  _defaults:
    autowire: true
    autoconfigure: true

  AutoAdmin\Bundle\Seo\Twig\AutoAdminSeoExtension:
    arguments:
      - '@AutoAdmin\Bundle\Content\Context\ContentContext'
    tags:
      - 'twig.extension'

  AutoAdmin\Bundle\Seo\Extractor\ExtractorManager: ~
#    public: true
#    arguments:
#      - !tagged_iterator aa_seo.extractor

  AutoAdmin\Bundle\Seo\Extractor\SeoContentExtractor:
    tags:
      - { name: 'aa_seo.extractor', priority: -10 }

  AutoAdmin\Bundle\Seo\Extractor\SchemaOrgExtractor:
    tags:
      - { name: 'aa_seo.extractor', priority: -20 }

  AutoAdmin\Bundle\Seo\Extractor\OpenGraphExtractor:
    tags:
      - { name: 'aa_seo.extractor', priority: -30 }

  AutoAdmin\Bundle\Seo\Extractor\TwitterExtractor:
    tags:
      - { name: 'aa_seo.extractor', priority: -30 }

  AutoAdmin\Bundle\Seo\Generator\GeneratorManager: ~
#    public: true
#    arguments:
#      - !tagged_iterator aa_seo.generator

  AutoAdmin\Bundle\Seo\Generator\DefaultGenerator:
    tags:
      - { name: 'aa_seo.generator', priority: -10 }

  AutoAdmin\Bundle\Seo\EventListener\RedirectEventListener:
    tags:
      # execute as fast as possible, just before router
      # symfony is using 32 for Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest()
      - { name: 'kernel.event_listener', event: 'kernel.request', priority: 33 }
    arguments:
      - '@doctrine' # todo, offset this in a cache-managed service

  AutoAdmin\Bundle\Seo\EventListener\ContentMetadataEventListener:
    tags:
      - { name: 'kernel.event_listener', event: 'content.metadata' }
    arguments:
      - '@AutoAdmin\Bundle\Seo\Extractor\ExtractorManager'

  AutoAdmin\Bundle\Seo\Controller\RobotsController:
    public: true
    arguments:
      - '@AutoAdmin\Bundle\Seo\Sitemap\SitemapRenderer'
      - '@router'
      - '@Doctrine\Persistence\ManagerRegistry'
      - '@AutoAdmin\Bundle\Content\Site\SiteContextHelper'

  AutoAdmin\Bundle\Seo\Controller\SitemapController:
    public: true
    arguments:
      - '@AutoAdmin\Bundle\Seo\Cache\SitemapCacheHandler'
      - '@AutoAdmin\Bundle\Content\Site\SiteContextHelper'

  AutoAdmin\Bundle\Seo\Cache\SitemapCacheHandler:
    arguments:
      - '@Doctrine\ORM\EntityManagerInterface'
      - '@AutoAdmin\Bundle\Seo\Sitemap\SitemapRenderer'
      - '@AutoAdmin\Bundle\Content\Site\SiteContextHelper'
      - '@AutoAdmin\Bundle\Core\Cache\CacheAdapterConfigurator'

  AutoAdmin\Bundle\Seo\Sitemap\SitemapManager:
    arguments:
      - !tagged_iterator aa_seo.sitemap_builder

  AutoAdmin\Bundle\Seo\Sitemap\ConfigSitemapBuilder:
    tags:
      - { name: 'aa_seo.sitemap_builder', priority: -10 }

  AutoAdmin\Bundle\Seo\Sitemap\SitemapRenderer:
    arguments:
      - '@AutoAdmin\Bundle\Seo\Sitemap\SitemapManager'
      - '%kernel.project_dir%'

  AutoAdmin\Bundle\Seo\Schema\Builder\BreadcrumbsSchemaBuilder:
    arguments:
      - '@AutoAdmin\Bundle\Content\Context\ContentContext'
      - '@AutoAdmin\Bundle\Content\Breadcrumbs\BreadcrumbsService'
    tags:
      - {name: 'aa_seo.schema_builder', priority: -10}

  AutoAdmin\Bundle\Seo\Schema\SchemaBuilderManager: ~
#    arguments:
#      - !tagged_iterator aa_seo.schema_builder

  AutoAdmin\Bundle\Seo\EventListener\SchemaBuildSubscriber:
    arguments:
      - '@AutoAdmin\Bundle\Seo\Schema\SchemaBuilderManager'
    tags:
      - { name: 'kernel.event_subscriber' }

  AutoAdmin\Bundle\Seo\Doctrine\EventListener\MetaDataSubscriber:
    tags:
      - { name: 'doctrine.event_subscriber', connection: 'default' }

  AutoAdmin\Bundle\Seo\Repository\RedirectRepository:
    tags:
      - { name: 'aa_content.repository' }

  AutoAdmin\Bundle\Seo\Command\SitemapCacheCommand:
    arguments:
      - '@AutoAdmin\Bundle\Seo\Sitemap\SitemapRenderer'
      - '@Doctrine\Persistence\ManagerRegistry'
      - '@AutoAdmin\Bundle\Content\Site\SiteContextHelper'
    tags: [ 'console.command' ]


  AutoAdmin\Bundle\Seo\Renderer\RendererManager:
    arguments:
      - !tagged_iterator aa_seo.renderer

  AutoAdmin\Bundle\Seo\Renderer\TagSeoRenderer:
    tags: [ 'aa_seo.renderer' ]

  AutoAdmin\Bundle\Seo\Renderer\SchemaOrgSeoRenderer:
    tags: [ 'aa_seo.renderer' ]

  AutoAdmin\Bundle\Seo\Redirect\RedirectService: ~
