imports:
    - { resource: bricks.yaml }

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    secret: '%env(APP_SECRET)%'

services:
    # default configuration for services
    _defaults:
        # automatically injects dependencies in your services
        autowire: true
        # automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true
        # this means you can fetch services directly from the container via $container->get()
        public: false

    # Commands
    App\Command\:
        resource: '../src/Command'
        tags: ['console.command']

    # Controllers
    App\Controller\:
        resource: '../src/Controller'
        public: true
        tags: ['controller.service_arguments']

    App\Controller\Helper\:
        resource: '../src/Controller/Helper'
        autowire: true

    # Event subscribers
    App\EventSubscriber\:
        resource: '../src/EventSubscriber'
        tags:
            - { name: kernel.event_subscriber }

    # Services
    App\Service\:
        resource: '../src/Service'
        autowire: true

    # Twig extensions
    App\Twig\Extension\:
        resource: '../src/Twig/Extension'
        tags: ['twig.extension']

    # Value calculators
    App\ValueCalculator\:
        resource: '../src/ValueCalculator'
        public: true

    # Link generators
    App\LinkGenerator\:
        resource: '../src/LinkGenerator'
        public: true

    # Options providers
    App\OptionsProvider\:
        resource: '../src/OptionsProvider'
        public: true

    # Pimcore provides a simple ObjectUserProvider which is able to load users from a specified class by a configured
    # field. The app.security.user_provider will load users from the App\Model\DataObject\User by looking at
    # their username field.
    app.security.user_provider:
        class: Pimcore\Security\User\ObjectUserProvider
        arguments:
            - 'App\Model\DataObject\User'
            - 'email'

    # The encoder factory is responsible for verifying the password hash for a given user. As we need some special
    # handling to be able to work with the password field, we use the UserAwareEncoderFactory to buiild a dedicated
    # encoder per user. This service is configured in pimcore.security.encoder_factories to handle our user model.
    app.security.password_encoder_factory:
        class: Pimcore\Security\Encoder\Factory\UserAwareEncoderFactory
        arguments:
            - Pimcore\Security\Encoder\PasswordFieldEncoder
            - ['password']