services:
    _defaults:
        autowire: true
        bind:
            FOS\UserBundle\Form\Factory\FormFactory $fosRegistrationFormFactory: '@fos_user.registration.form.factory'
            FOS\UserBundle\Form\Factory\FormFactory $fosChangePasswordFormFactory: '@fos_user.change_password.form.factory'
            FOS\UserBundle\Form\Factory\FormFactory $fosResettingFormFactory: '@fos_user.resetting.form.factory'
            FOS\UserBundle\Util\TokenGenerator $fosTokenGenerator: '@fos_user.util.token_generator'
            FOS\UserBundle\Mailer\MailerInterface $fosMailer: '@fos_user.mailer'
            FOS\UserBundle\Model\UserManagerInterface $fosUserManager: '@fos_user.user_manager'

    OceanExpertBundle\Repository\:
        resource: '../src/OceanExpertBundle/Repository'
        tags: [ 'doctrine.repository_service' ]

    OceanExpertBundle\Controller\:
        resource: '../src/OceanExpertBundle/Controller'
        tags: [ 'controller.service_arguments' ]

    OceanExpertBundle\Command\:
        resource: '../src/OceanExpertBundle/Command'
        tags: [ 'console.command' ]

    acme_api.event.jwt_created_listener:
        class: OceanExpertBundle\EventListener\JWTCreatedListener
        arguments:
            - '@request_stack'
            - '@doctrine.orm.entity_manager'
        tags:
            - { name: kernel.event_listener, event: lexik_jwt_authentication.on_jwt_created, method: onJWTCreated }

    fos_user.doctrine_registry:
        alias: doctrine

    twig.extension.text:
        class: Twig_Extensions_Extension_Text
        tags:
            - { name: twig.extension }
    app.byte_conversion.twig.extension:
        class: OceanExpertBundle\Twig\Extension\ByteConversionTwigExtension
        tags:
            - { name: twig.extension }

    app.file.twig.extension:
        class: OceanExpertBundle\Twig\Extension\FileExtension
        tags:
            - { name: twig.extension }

#no idea if this is working or not
#was created for #222
    jwt_token_authenticator:
        class: OceanExpertBundle\Security\JwtTokenAuthenticator
        autowire: true

#    ocean_expert.example:
#        class: OceanExpertBundle\Example
#        arguments: ["@service_id", "plain_value", %parameter%]

#we need this to be able to use things like 'generateUrl in the console commands
#   like 'symfony console oceanexpert:processQueuedFiles'
#   see https://symfony.com/doc/4.1/console/request_context.html
parameters:
    router.request_context.host: 'stag.oceanexpert.org'
    router.request_context.scheme: 'https'
    router.request_context.base_url: '%router.request_context.scheme%://%router.request_context.host%'
    asset.request_context.secure: true
