# yaml-language-server: $schema=../vendor/symfony/dependency-injection/Loader/schema/services.schema.json

# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# See also https://symfony.com/doc/current/service_container/import.html

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

services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
        bind:
            $publicUrl: '%app.public_url%'
            $deviceCredentialPepper: '%env(DEVICE_CREDENTIAL_PEPPER)%'
            $devicePairingPepper: '%env(DEVICE_PAIRING_PEPPER)%'
            $deviceSessionTtlDays: '%env(int:DEVICE_SESSION_TTL_DAYS)%'
            $devicePairingCodeTtlMinutes: '%env(int:DEVICE_PAIRING_CODE_TTL_MINUTES)%'
            $deviceProbesEnabled: '%env(bool:DEVICE_PROBES_ENABLED)%'

    # 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/'

    Symfony\Component\RateLimiter\RateLimiterFactory $devicePairingLimiter:
        alias: limiter.device_pairing

    Symfony\Component\RateLimiter\RateLimiterFactory $parentLoginLimiter:
        alias: limiter.parent_login

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