# 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:
    agencies_upload_dir: '%kernel.project_dir%/public/uploads/agencies'

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


    App\DataFixtures\Provider\PasswordProvider:
        arguments:
            $passwordHasher: '@security.user_password_hasher'
        tags:
            - { name: nelmio_alice.faker.provider }

    App\DataFixtures\Provider\MoroccanProvider:
        tags:
            - { name: nelmio_alice.faker.provider }

    # Alias pour compatibilité
    app.password_provider:
        alias: App\DataFixtures\Provider\PasswordProvider
        public: true

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

    uuid_factory.v7:
        class: Symfony\Component\Uid\Factory\UuidFactory
        arguments:
            $defaultClass: Symfony\Component\Uid\UuidV7

    Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator:
        arguments:
            $factory: '@uuid_factory.v7'

    App\Service\FileUploadService:
        arguments:
            $uploadDir: '%agencies_upload_dir%'

    App\Controller\RentalContractController:
        arguments:
            $agenciesUploadDir: '%agencies_upload_dir%'
            $projectDir: '%kernel.project_dir%'
            $cache: '@cache.app'

    App\Twig\ImageBase64Extension:
        arguments:
            $agenciesUploadDir: '%agencies_upload_dir%'
            $publicDir:         '%kernel.project_dir%/public'
            $cache:             '@cache.app'

    App\Command\MigrateAgenceDataCommand:
        arguments:
            $em:            '@doctrine.orm.entity_manager'
            $validator:     '@validator'
            $mysqlHost:     '%env(MYSQL_SOURCE_HOST)%'
            $mysqlPort:     '%env(MYSQL_SOURCE_PORT)%'
            $mysqlUser:     '%env(MYSQL_SOURCE_USER)%'
            $mysqlPassword: '%env(MYSQL_SOURCE_PASSWORD)%'

