services:
  _defaults:
    autowire: true
    autoconfigure: true

  AutoAdmin\Bundle\Content\Translation\EntityTranslator:
    public: true
    calls:
      - [ 'setLocale', [ '%default_locale%' ] ]

  AutoAdmin\Bundle\Content\EventListener\CurrentTranslationLoader:
    public: false
    tags:
      - { name: 'doctrine.event_subscriber' }
    arguments:
      - '@AutoAdmin\Bundle\Content\Translation\EntityTranslator'

  AutoAdmin\Bundle\Content\Doctrine\EventListener\StaticTranslationSubscriber:
    public: false
    tags:
      - { name: 'doctrine.event_subscriber', connection: 'default' }
    arguments:
      - '@AutoAdmin\Bundle\Content\Cache\StaticTranslationCacheHandler'

  AutoAdmin\Bundle\Content\Twig\Extension\TranslationExtension:
    public: false
    tags:
      - { name: 'twig.extension' }
    arguments:
      - '@AutoAdmin\Bundle\Content\Translation\EntityTranslator'
      - '@AutoAdmin\Bundle\Content\Provider\TranslationProvider'

  AutoAdmin\Bundle\Content\Cache\StaticTranslationCacheHandler:
    arguments:
      - '@Doctrine\ORM\EntityManagerInterface'
      - '@AutoAdmin\Bundle\Core\Cache\CacheAdapterConfigurator'
    tags:
      - { name: 'kernel.cache_warmer', priority: 0 }

  AutoAdmin\Bundle\Content\Provider\TranslationProvider:
    arguments:
      - '@AutoAdmin\Bundle\Content\Cache\StaticTranslationCacheHandler'
      - '@AutoAdmin\Bundle\Content\Site\SiteContextHelper'
      - '@translator'
      - '@AutoAdmin\Bundle\Content\Configuration\ConfigManager'
      - '%kernel.environment%'

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

  AutoAdmin\Bundle\Content\Doctrine\EventListener\TranslationCreationListener:
    arguments:
      - '@AutoAdmin\Bundle\Content\Translation\EntityTranslator'
      - '@AutoAdmin\Bundle\Admin\Factory\ContentFactory'
    tags:
      - { name: 'doctrine.event_subscriber', connection: 'default' }

  AutoAdmin\Bundle\Content\Command\StaticTranslationCommand:
    arguments:
      - '@Doctrine\ORM\EntityManagerInterface'
      - '@AutoAdmin\Bundle\Content\Translation\EntityTranslator'
      - '@AutoAdmin\Bundle\Content\Site\SiteContextHelper'
      - '%kernel.project_dir%'
    tags: [ 'console.command' ]

  AutoAdmin\Bundle\Content\Translation\LocaleResolver:
    arguments:
      - '@request_stack'
      - '@AutoAdmin\Bundle\Content\Site\SiteContextHelper'

  AutoAdmin\Bundle\Content\Translation\LocaleSwitchHelper: ~
