# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# 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:
    env(INSEE_API_KEY): ''
    env(CALENDAR_TOKEN_ENCRYPTION_KEY): ''
    env(GOOGLE_CLIENT_ID): ''
    env(GOOGLE_CLIENT_SECRET): ''
    env(GOOGLE_REDIRECT_URI): ''
    env(GOOGLE_CALENDAR_WEBHOOK_URL): ''
    env(GOOGLE_CALENDAR_ALLOWED_SCOPES): ''
    env(GOOGLE_CALENDAR_FREEBUSY_ENABLED): '0'
    env(MAILER_FROM_EMAIL): 'no-reply@capsule.local'
    env(MAILER_FROM_NAME): 'Capsule'
    app.email_default_from: '%env(MAILER_FROM_EMAIL)%'
    app.email_default_name: '%env(MAILER_FROM_NAME)%'
    app.email_attachments_dir: '%kernel.project_dir%/var/email_attachments'

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.

    # 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/Bundles/'
            - '../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
    App\Bundles\AppBundle\Service\Context\:
        resource: '../src/Bundles/AppBundle/Service/Context/'

    App\Bundles\AppBundle\Service\DeviceService: ~
    App\Bundles\AppBundle\Service\AppDashboardProvider: ~
    App\Bundles\AppBundle\Service\MenuService:
        arguments:
            $prospectionRepository: null
            $resourceCenterService: null
    App\Bundles\AppBundle\Service\SubscriptionAccessService:
        arguments:
            $subscriptionModuleRepository: null
            $meceneRepository: null
    App\Bundles\AppBundle\Twig\AppContextExtension: ~
    App\Bundles\AppBundle\Twig\AppMenuExtension: ~
    App\Bundles\AppBundle\Twig\NotificationExtension: ~
    App\Bundles\AppBundle\Twig\UserAvatarExtension: ~

    App\Bundle\AppBundle\Repository\NotificationRepository:
        arguments: ['@doctrine']
        tags: ['doctrine.repository_service']
    App\Bundle\AppBundle\Notification\NotificationTypeMapper: ~
    App\Bundle\AppBundle\Service\NotificationRealtimePublisher: ~
    App\Bundle\AppBundle\Service\NotificationService: ~
    App\Bundles\AppBundle\Controller\NotificationController:
        tags: ['controller.service_arguments']
    App\Bundles\AppBundle\Service\ToastFactory: ~
    App\Bundles\AppBundle\Service\UserAvatarStorage: ~
    App\Bundles\AppBundle\Twig\SubscriptionAccessExtension: ~

    App\Bundles\AppBundle\Controller\DashboardController:
        tags: ['controller.service_arguments']

    App\Bundles\AppBundle\Controller\NotificationFallbackController:
        tags: ['controller.service_arguments']

    App\Bundles\AppBundle\Controller\AccountFallbackController:
        tags: ['controller.service_arguments']

    App\Bundles\AppBundle\Controller\CompanyContextController:
        tags: ['controller.service_arguments']

    App\Bundles\AppBundle\Security\LoginSuccessHandler: ~

    App\Bundles\AppBundle\Service\SireneService:
        arguments:
            $apiKey: '%env(INSEE_API_KEY)%'

    App\Bundle\AdminBundle\:
        resource: '../src/Bundles/AdminBundle/'
        exclude:
            - '../src/Bundles/AdminBundle/DependencyInjection/'
            - '../src/Bundles/AdminBundle/Entity/'
            - '../src/Bundles/AdminBundle/AdminBundle.php'

    App\Bundle\AdminBundle\Controller\:
        resource: '../src/Bundles/AdminBundle/Controller/'
        tags: ['controller.service_arguments']

    App\Bundle\AdminBundle\Repository\UserRepository:
        arguments:
            - '@doctrine'
        tags:
            - { name: doctrine.repository_service }

    App\Bundle\AdminBundle\Repository\SocieteRepository:
        arguments:
            - '@doctrine'
        tags:
            - { name: doctrine.repository_service }

    App\Bundle\CommercialBundle\:
        resource: '../src/Bundles/CommercialBundle/'
        exclude:
            - '../src/Bundles/CommercialBundle/DependencyInjection/'
            - '../src/Bundles/CommercialBundle/Entity/'
            - '../src/Bundles/CommercialBundle/Form/'
            - '../src/Bundles/CommercialBundle/Calendar/Entity/'
            - '../src/Bundles/CommercialBundle/CommercialBundle.php'

    App\Bundle\CommercialBundle\Controller\:
        resource: '../src/Bundles/CommercialBundle/Controller/'
        tags: ['controller.service_arguments']

    App\Bundle\CommercialBundle\Billing\Controller\:
        resource: '../src/Bundles/CommercialBundle/Billing/Controller/'
        tags: ['controller.service_arguments']

    App\Bundle\CommercialBundle\Calendar\Service\CalendarTokenCipher:
        arguments:
            $encryptionKey: '%env(CALENDAR_TOKEN_ENCRYPTION_KEY)%'
            $environment: '%kernel.environment%'

    App\Bundle\CommercialBundle\Calendar\Service\GoogleCalendarClient:
        arguments:
            $clientId: '%env(GOOGLE_CLIENT_ID)%'
            $clientSecret: '%env(GOOGLE_CLIENT_SECRET)%'

    App\Bundle\CommercialBundle\Calendar\Service\GoogleCalendarOAuthService:
        arguments:
            $clientId: '%env(GOOGLE_CLIENT_ID)%'
            $redirectUri: '%env(GOOGLE_REDIRECT_URI)%'
            $allowedScopes: '%env(GOOGLE_CALENDAR_ALLOWED_SCOPES)%'

    App\Bundle\CommercialBundle\Calendar\Service\GoogleCalendarWebhookManager:
        arguments:
            $webhookUrl: '%env(GOOGLE_CALENDAR_WEBHOOK_URL)%'

    App\Bundle\CommercialBundle\Calendar\Service\GoogleCalendarFreeBusyService:
        arguments:
            $enabled: '%env(bool:GOOGLE_CALENDAR_FREEBUSY_ENABLED)%'

    App\Bundle\SocieteBundle\:
        resource: '../src/Bundles/SocieteBundle/'
        exclude:
            - '../src/Bundles/SocieteBundle/SocieteBundle.php'

    App\Bundle\SocieteBundle\Controller\:
        resource: '../src/Bundles/SocieteBundle/Controller/'
        tags: ['controller.service_arguments']

    App\Bundle\SocieteBundle\Service\SocieteLogoManager:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Bundle\ProjetBundle\:
        resource: '../src/Bundles/ProjetBundle/'
        exclude:
            - '../src/Bundles/ProjetBundle/DependencyInjection/'
            - '../src/Bundles/ProjetBundle/Entity/'
            - '../src/Bundles/ProjetBundle/Form/'
            - '../src/Bundles/ProjetBundle/ProjetBundle.php'

    App\Bundle\ProjetBundle\Controller\:
        resource: '../src/Bundles/ProjetBundle/Controller/'
        tags: ['controller.service_arguments']

    App\Bundle\SalaireBundle\:
        resource: '../src/Bundles/SalaireBundle/'
        exclude:
            - '../src/Bundles/SalaireBundle/DependencyInjection/'
            - '../src/Bundles/SalaireBundle/Entity/'
            - '../src/Bundles/SalaireBundle/SalaireBundle.php'

    App\Bundle\SalaireBundle\Controller\:
        resource: '../src/Bundles/SalaireBundle/Controller/'
        tags: ['controller.service_arguments']

    App\Bundle\EmailBundle\:
        resource: '../src/Bundles/EmailBundle/'
        exclude:
            - '../src/Bundles/EmailBundle/DependencyInjection/'
            - '../src/Bundles/EmailBundle/Entity/'
            - '../src/Bundles/EmailBundle/EmailBundle.php'

    App\Bundle\EmailBundle\Controller\:
        resource: '../src/Bundles/EmailBundle/Controller/'
        tags: ['controller.service_arguments']
