parameters:
    upload_directory: "%env(resolve:UPLOAD_DIR)%"
    keycloak_realm: "%env(resolve:KEYCLOAK_REALM)%"
    keycloak_url: "%env(resolve:KEYCLOAK_URL)%"
    mailbox_host: "%env(resolve:MAILBOX_HOST)%"
    mailbox_username: "%env(resolve:MAILBOX_USERNAME)%"
    mailbox_password: "%env(resolve:MAILBOX_PASSWORD)%"
    trello_apikey: "%env(resolve:TRELLO_API_KEY)%"
    trello_apitoken: "%env(resolve:TRELLO_API_TOKEN)%"

services:
    _defaults:
        autowire: true # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
        bind:
            string $mailboxHost: "%mailbox_host%"
            string $mailboxUsername: "%mailbox_username%"
            string $mailboxPassword: "%mailbox_password%"
            string $apiKey: "%trello_apikey%"
            string $apiToken: "%trello_apitoken%"

    App\EventListener\PersistListener:
        arguments:
            $tokenStorage: "@security.token_storage"
        tags:
            - { name: doctrine.event_listener, event: prePersist }
            # - { name: doctrine.event_listener, event: preUpdate }

    App\Service\Config\MailBoxService:
        arguments:
            $mailboxHost: "%mailbox_host%"
            $mailboxUsername: "%mailbox_username%"
            $mailboxPassword: "%mailbox_password%"

    App\Service\Config\TrelloService:
        arguments:
            $apiKey: "%trello_apikey%"
            $apiToken: "%trello_apitoken%"

    App\Serializer\PotentialDenormalizer:
        arguments:
            $entityManager: "@doctrine.orm.entity_manager"
        tags: ["serializer.normalizer"]

    App\Serializer\SharedNormalizer:
        arguments:
            $userService: 'App\Service\Security\UserService'
        tags:
            - { name: "serializer.normalizer" }

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: "../src/"
        exclude:
            - "../src/DependencyInjection/"
            - "../src/Entity/"
            - "../src/Kernel.php"

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones
