# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:

services:
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
        bind:
            string $kernelProjectDir: '%kernel.project_dir%'
            string $publicDir: '%kernel.project_dir%/public'
            string $kernelEnvironment: '%kernel.environment%'

    App\:
        resource: '../src/'
        exclude:
            - '../src/DependencyInjection/'
            - '../src/Dto/'
            - '../src/Entity/'
            - '../src/Event/EventListener'
            - '../src/Helper/'
            - '../src/Kernel.php'
            - '../src/Pdf/Formulario'

    App\Command\Solicitud\SolicitudCreateCommand:
        tags:
            - { name: console.command }
            - { name: kernel.event_listener, event: console.error }
    App\Command\ExportCommand:
        tags:
            - { name: console.command }
            - { name: kernel.event_listener, event: console.error }

    App\DataTable\DataTableFactory:
        arguments:
            - '%datatables.config%'
            - '@Omines\DataTablesBundle\Twig\TwigRenderer'
            - '@Omines\DataTablesBundle\DependencyInjection\Instantiator'
            - '@event_dispatcher'
    App\DataTable\Column\ActionsColumn\ActionButton:
        public: true
        shared: false
    App\DataTable\Column\ActionsColumn\ActionDynamic:
        public: true
        shared: false
    App\DataTable\Column\ActionsColumn\ActionRoute:
        public: true
        shared: false
    App\DataTable\Column\ActionsColumn\ActionSubmit:
        public: true
        shared: false
    App\DataTable\Column\ActionsColumn\ActionSubmitConfirm:
        public: true
        shared: false


    App\Event\EventListener\ExceptionToJsonListener:
        tags:
            - { name: kernel.event_listener, event: kernel.exception }

    App\Event\EventListener\SolicitudDeleteListener:
        tags:
            -
                name: 'doctrine.orm.entity_listener'
                event: preRemove
                entity: App\Entity\Solicitud\Solicitud

    App\Pdf\TerceroPdfFactory:
        $pdfPath: '%kernel.project_dir%/var/pdf'
    App\Pdf\TerceroPdf:
        factory: ['@App\Pdf\TerceroPdfFactory', 'getPdf']

    App\Service\CodigoPostal:
        $layoutUrl: '/472/visor/javascript/layout.aspx'
        $codigoPostalUrl: '/RestService472/CodigoPostal/EntryOrdinary'

    App\Service\Configuracion\Mailer:
        factory: [ '@App\Service\Configuracion\Configuracion', mailer ]

    App\Service\Configuracion\TerceroConfiguracion:
        factory: [ '@App\Service\Configuracion\Configuracion', getTercero ]

    App\Service\Email\GmailOAuthTransportFactory:
        tags: [ 'mailer.transport_factory' ]

    App\Service\Email\GoogleClient:
        arguments:
            - '%env(GOOGLE_CLIENT_ID)%'
            - '%env(GOOGLE_CLIENT_SECRET)%'
            - '%kernel.project_dir%/var/app/google-token.json'

    App\Service\File\FixturesFileService:
        $fixturesPath: '%kernel.project_dir%/tests/fixtures'

    App\Twig\TerceroTwigLoader:
        decorates: 'twig.loader'
        arguments: ['@.inner']

when@test:
    parameters:
        liip_test_fixtures.keep_database_and_schema: true
    services:
        App\Tests\Factory\UserFactory:
            arguments:
                - '@Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface'
                - '@App\Service\Configuracion\Configuracion'
                - '@App\Service\Util\Varchar'
            tags:
                - {name: 'foundry.factory'}

        App\Tests\DataFixtures\ContactoFixtures:
            arguments:
                - '@doctrine.orm.default_entity_manager'
                - '@App\Tests\DataFixtures\TerceroFixtures'
                - '@App\Repository\ContactoTipoRepository'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\DocumentoFixtures:
            arguments:
                - '@doctrine.orm.default_entity_manager'
                - '@App\Service\File\FixturesFileService'
                - '@mime_types'
                - '@App\Service\File\FileService'
                - '@App\Repository\DocumentoTipoRepository'
                - '@property_accessor'
                - '@App\Service\File\UploaderHelper'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\FixturesHelper:
            arguments:
                - '@Liip\TestFixturesBundle\Services\DatabaseToolCollection'
                - '@doctrine.orm.default_entity_manager'
                - '@doctrine.fixtures.loader'
                - '@App\Service\Configuracion\Configuracion'
                - '@App\Service\File\FixturesFileService'
            public: true
        App\Tests\DataFixtures\OpcionEditableFixtures:
            arguments:
                - '@App\Service\Seed\SeedFactory'
                - '@App\Service\Configuracion\OpcionEditableConfiguracion'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\RegimenTributarioFixtures:
            arguments:
                - '@doctrine.orm.default_entity_manager'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\RepresentanteFixtures:
            arguments:
                - '@Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface'
                - '@App\Service\Configuracion\Configuracion'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\RepresentanteLegalFixtures:
            arguments:
                - '@doctrine.orm.default_entity_manager'
                - '@App\Tests\DataFixtures\TerceroFixtures'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\SolicitudFixtures:
            arguments:
                - '@App\Service\Configuracion\Configuracion'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\SolicitudContactoFixtures:
            arguments:
                - '@App\Service\Solicitud\SolicitudService'
                - '@App\Repository\ContactoTipoRepository'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\SolicitudDocumentoFixtures:
            arguments:
                - '@App\Service\Solicitud\SolicitudService'
                - '@App\Repository\DocumentoTipoRepository'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\SolicitudRegimenTributarioFixtures:
            arguments:
                - '@App\Service\Solicitud\SolicitudService'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\SolicitudRepresentanteLegalFixtures:
            arguments:
                - '@App\Service\Solicitud\SolicitudService'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\SolicitudTerminosFixtures:
            arguments:
                - '@App\Service\Solicitud\SolicitudService'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\TerceroFixtures:
            arguments:
                - '@doctrine.orm.default_entity_manager'
                - '@App\Service\Configuracion\Configuracion'
                - '@App\Tests\DataFixtures\FixturesHelper'
                - '@property_accessor'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\TerminosFixtures:
            arguments:
                - '@App\Service\File\FixturesFileService'
                - '@App\Tests\DataFixtures\DocumentoFixtures'
                - '@App\Repository\DocumentoTipoRepository'
                - '@property_accessor'
                - '@App\Service\File\UploaderHelper'
            tags:
                - { name: 'doctrine.fixture.orm' }
        App\Tests\DataFixtures\UserFixtures:
            arguments:
                - '@Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface'
            tags:
                - {name: 'doctrine.fixture.orm'}