# 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/configuration.html#application-related-configuration

parameters:
    locale: 'en'
    encrypt_key: M5SWDGMo8b5SeupQCZYK8koURuCYlg14KE+EgODKeVs=
    router.request_context.scheme: 'https'
    asset.request_context.secure: true
    sonata.user.admin.user.controller: 'App\Controller\CRUD\CRUDController'
    sonata.media.admin.media.class: 'App\Admin\MediaAdmin'
    sonata.media.admin.gallery.class: 'App\Admin\GalleryAdmin'
    tav_env: '%env(TAV_ENV)%'
    presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%'
    automatisation_reconversion: '%env(AUTOMATISATION_RECONVERSION)%'
    presta_extra_data: '%env(PRESTA_EXTRA_DATA)%'
    household_based_allowance: '%env(HOUSEHOLD_BASED_ALLOWANCE)%'
    simplified_household_based_allowance: '%env(SIMPLIFIED_HOUSEHOLD_BASED_ALLOWANCE)%'
    ssa_friendly_flux_type_names: '%env(SSA_FRIENDLY_FLUX_TYPE_NAMES)%'
    extra_security_admin_password: '%env(EXTRA_SECURITY_ADMIN_PASSWORD)%'
    ccas_mode: '%env(CCAS_MODE)%'
    use_external_data: '%env(USE_EXTERNAL_DATA)%'


    # PARAMETRES DES IMPORTS POSSIBLE POUR L'APPLICATION DE GESTION DE MONNAIE LOCALE COMPLEMENTAIRE
    app.import.separator: ';'
    app.import.header:
        groupe:
            header: 'idmlc;nom;description;compte'
            example: 'Groupe local n°1;<b>Groupe local n°1</b>;123'
            filecsv: '/csv/groupe.csv'
            filexls: '/csv/groupe.xlsx'
            filenum: '/csv/groupe.numbers'
        comptoir:
            header: 'idmlc;groupe;nom;description;adresse;cpostal;ville;latitude;longitude;compte;contact1;phone1;email1;contact2;phone2;email2;contact3;phone3;email3'
            example: 'Groupe local n°1;Comptoir n°1;<b>Comptoir n°1</b>;2, rue charles de gaulle;12345;Paris;45,12345;3,12345;123;M. Jean Dupont;0612345678;jean.dupont@email.com;Contact comptoir;0198765432;contact.comptoir@email.com;Contact 3;0198765432;contact.comptoir2@email.com'
            filecsv: '/csv/comptoir.csv'
            filexls: '/csv/comptoir.xlsx'
            filenum: '/csv/comptoir.numbers'
        adherent:
            header: 'idmlc;groupe;firstname;lastname;email;phone;mobile;adresse;cpostal;ville;ecompte;cotisations'
            example: 'Groupe local n°1;Jean;Dupont;jean.dupont@gmail.com;013456789;0612345678;"2; rue Charles de gaulle";12345;Paris;"12,34";"10:2017,10:2018,10:2019"'
            filecsv: '/csv/adherent.csv'
            filexls: '/csv/adherent.xlsx'
            filenum: '/csv/adherent.numbers'
        prestataire:
            header: 'idmlc;groupe;adresse;cpostal;ville;raison;ecompte;metier;statut;responsable;iban;siret;web;horaires;description;rubriques;tags;tauxreconversion;contact1;phone1;email1;contact2;phone2;email2;contact3;phone3;email3'
            example: 'Groupe local n°1;2, rue Charles de gaulle;12345;Paris;Nom du prestataire;123,45;Directeur;SARL;Jean Dupont;FR7630001007941234567890185;732 829 320 00074;www.siteweb.com;Dimanche de 8h à 12h;<b>Description du prestataire</b>;Amap,Fruits,Légumes,Marchés;tag1,tag2;2;M. Jean Dupont;0123456789;jean.dupont@email.com;Contact comptoir;0698765432;contact.comptoir@email.com;Contact 3;0198765432;contact.comptoir2@email.com'
            filecsv: '/csv/prestataire.csv'
            filexls: '/csv/prestataire.xlsx'
            filenum: '/csv/prestataire.numbers'
        flux:
            header: 'exp_idmlc|exp;exp_type;dest_idmlc|dest;dest_type;user_email;montant;devise;date;type;moyen;reference;tauxreconversion;data'
            example: '12987542;prestataire;prestamonnaielocale;prestataire;toto@toto.com;10;euro;2020-11-29 14:53;cotisation;cb;1007941234567890185;0;toto,titi,tutu...'
            filecsv: '/csv/flux.csv'
            filexls: '/csv/flux.xlsx'
            filenum: '/csv/flux.numbers'

# SERVICES
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/{DependencyInjection,Factory,Doctrine,Listener,Entity,Migrations,Tests,Twig,Kernel.php}'

    # controllers are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base controller class
    App\Controller\:
        resource: '../src/Controller/'
        tags: ['controller.service_arguments']

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

    # Définition du prefix pour les tables
    #   -> Préfixes abandonnés pour l'instant
    # App\Doctrine\TablePrefix:
    #     arguments:
    #         $prefix: '%env(string:DATABASE_PREFIX)%'
    #     tags:
    #         - { name: doctrine.event_subscriber, connection: default }

    # cache doctrine for bazinga geocoder
    mlc_cache_adapter:
        class: Doctrine\Common\Cache\ApcCache

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones
    apikey_authenticator:
        class:  App\Security\ApiKeyAuthenticator
        public: false
    
    api_key_user_provider:
        class: App\Security\ApiKeyUserProvider
        arguments:
            - '@doctrine.orm.entity_manager'

    redirect.after.login:
        class: App\Listener\AfterLoginRedirection
        autowire: false
        arguments: ['@router', '@doctrine.orm.entity_manager', '@security.token_storage', '@session']

    app.utils.custom_entity_manager:
        class: App\Utils\CustomEntityManager
        autowire: true
        
    app.utils.operations:
        class: App\Utils\OperationUtils
        autowire: false
        arguments: ['@app.utils.custom_entity_manager', '@session', '@security.helper', '@event_dispatcher']

    app.utils.cotisations:
        class: App\Utils\CotisationUtils
        autowire: false
        public: true
        arguments: ['@app.utils.custom_entity_manager', '@session', '@security.helper', '@event_dispatcher', '@service_container']

    app.utils.account:
        class: App\Utils\AccountUtils
        autowire: false
        arguments: ['@doctrine.orm.entity_manager']

    app.utils.tav_cotisations:
        class: App\Utils\TAVCotisationUtils
        autowire: false
        public: true
        arguments: ['@app.utils.custom_entity_manager', '@security.helper', '@app.utils.operations', '@service_container']

    app.utils.payment:
        class: App\Utils\PaymentUtils
        autowire: true

    app.utils.moyens:
        class: App\Utils\MoyensUtils
        autowire: true
        public: true
        arguments: ['@app.utils.custom_entity_manager']

    app.twig.main.extension:
        class: App\Twig\AppExtension
        autowire: false
        arguments: ["@service_container", "@security.helper", "@doctrine.orm.entity_manager", "@knp_paginator", "@session", "@app.utils.operations", "@app.utils.cotisations", "@app.utils.tav_cotisations"]

    app.twig.logentry.extension:
        class: App\Twig\LogEntryExtension
        autowire: false
        arguments: ["@doctrine.orm.entity_manager"]

    app.twig.unserialize.extension:
        class: App\Twig\UnserializeExtension
        autowire: false

    app.twig.getclass.extension:
        class: App\Twig\GetClassExtension
        autowire: false

    app.twig.extension.flux:
        class: App\Twig\FluxExtension
        autowire: false
        arguments: ["@service_container", "@security.helper", "@doctrine.orm.entity_manager", "@knp_paginator", "@session"]

    app.twig.mlc.globals.extension:
        class: App\Twig\MlcGlobalsExtension
        autowire: false
        arguments: ["@doctrine.orm.entity_manager"]

    app.twig.solidoume.extension:
        class: App\Twig\SolidoumeExtension
        autowire: true

    app.listener.unitofwork:
        class: App\Listener\UnitOfWorkListener
        tags:
            - { name: doctrine.event_subscriber, connection: default }

    app.twig.form.extension:
        class: App\Twig\FormExtension
        autowire: false
        arguments: ["@service_container"]

    app.twig.menu.extension:
        class: App\Twig\MenuExtension
        autowire: false
        arguments: ["@doctrine.orm.entity_manager", "@prodigious_sonata_menu.manager"]

    app.twig.stats.extension:
        class: App\Twig\StatsExtension
        autowire: false
        arguments: ["@doctrine.orm.entity_manager"]

    app.formfactory:
        class: App\Factory\FormFactory
        autowire: true
        public: true

    App\Controller\RegistrationController:
        autowire: false

    App\Controller\ResettingController:
        arguments:
            $userManager: '@fos_user.user_manager'
            $formFactory: '@fos_user.resetting.form.factory'
            $dispatcher: '@event_dispatcher'
        tags: ['controller.service_arguments']

    App\EventListener\PreventDisabledUserAutoLoginListener:
        arguments:
            $tokenStorage: '@security.token_storage'
            $requestStack: '@request_stack'
        tags:
            - { name: kernel.event_subscriber }

    app.flux.listener:
        class: App\Listener\FluxListener
        tags:
            - { name: doctrine.event_subscriber, connection: default }

    app.hidden_entity_type_extension:
        class: App\Form\HiddenEntityExtension
        tags:
            - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\HiddenType }

    app.listener.geoloc.preupdate:
        class: App\EventListener\GeolocListener
        tags:
            - { name: doctrine.event_listener, event: preUpdate }
    app.listener.geoloc.postPersist:
        class: App\EventListener\GeolocListener
        tags:
            - { name: doctrine.event_listener, event: postPersist }

    mlc.user.listener:
        class: App\EventListener\UserListener
        autowire: true
        tags:
            - { name: kernel.event_subscriber }

    app.form.extension.media:
        class: App\Form\Extension\MediaTypeExtension
        tags:
            - { name: form.type_extension }
            # - { name: form.type_extension, extended_type: Sonata\MediaBundle\Form\Type\MediaType }

    app.security.handler.role:
        class: App\Security\Handler\VoterSecurityHandler
        arguments:
            - '@security.authorization_checker'
            - [ROLE_SUPER_ADMIN]
        calls:
            - [setManager, ['@doctrine.orm.entity_manager']]

    app.payzen_gateway_factory:
        class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder
        arguments: [Ekyna\Component\Payum\Payzen\PayzenGatewayFactory]
        tags:
            - { name: payum.gateway_factory_builder, factory: payzen }

    app.payum.extension.payment_status:
        class: App\EventListener\PaymentStatusExtension
        public: true
        autowire: true
        tags:
            - { name: payum.extension, all: true, prepend: false }

    ###### Configuration de l'admin ######

    admin.block.dashboard:
        class: App\Block\DashboardKohinosBlock
        arguments:
            - '@twig'
        tags:
            - { name: sonata.block }

    admin.adherent.gerer:
        class: App\Admin\AdherentAdmin
        # arguments: [~, App\Entity\OBJECT, 'PixSortableBehaviorBundle:SortableAdmin']
        arguments: [~, App\Entity\Adherent, 'App\Controller\AdherentAdminController']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Adherent"
              label: "Liste"
            # - group: "Contenu"
            # - label: "Adhérents"
            # - label_catalogue: "App"
        public: true
        calls:
            - [ setUserManager, ['@fos_user.user_manager']]
            - [ setSecurity, ['@security.helper']]
            - [ setEventDispatcher, ['@event_dispatcher']]
            - [ setTavCotisationUtils, ['@app.utils.tav_cotisations']]

    admin.all.cotisations:
        class: App\Admin\CotisationAdmin
        arguments: [~, App\Entity\Cotisation, 'App\Controller\CRUD\CRUDController']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Cotisations"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]
            - [ setOperationUtils, ['@app.utils.operations']]

    admin.all.achatsmonnaie:
        class: App\Admin\AchatMonnaieAdmin
        arguments: [~, App\Entity\AchatMonnaie, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Achats de monnaie"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.all.demande.achatsmonnaie:
        class: App\Admin\AchatMonnaieAConfirmerAdmin
        arguments: [~, App\Entity\AchatMonnaieAConfirmer, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Demandes d'achat de monnaie"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.adherent.cotisations:
        class: App\Admin\CotisationAdherentAdmin
        arguments: [~, App\Entity\CotisationAdherent, 'App\Controller\CRUD\CRUDController']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Adherent"
              label: "Cotisation"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]
            - [ setOperationUtils, ['@app.utils.operations']]

    admin.adherent.profilsdecotisation:
        class: App\Admin\ProfilDeCotisationAdmin
        arguments: [~, App\Entity\ProfilDeCotisation, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Adherent"
              label: "Profils De Cotisation"
        public: true

    admin.prestataire.gerer:
        class: App\Admin\PrestataireAdmin
        arguments: [~, App\Entity\Prestataire, App\Controller\PrestataireAdminController]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Prestataire"
              label: "Liste"
        public: true
        calls:
            - [ setUserManager, ['@fos_user.user_manager']]
            - [ addChild, ['@sonata.user.admin.user', 'user']]
            - [ setSecurity, ['@security.helper']]
            - [ setPool, ['@sonata.media.pool']]
            - [ setEventDispatcher, ['@event_dispatcher']]

    admin.prestataire.cotisations:
        class: App\Admin\CotisationPrestataireAdmin
        arguments: [~, App\Entity\CotisationPrestataire, 'App\Controller\CRUD\CRUDController']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Prestataire"
              label: "Cotisation"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]
            - [ setOperationUtils, ['@app.utils.operations']]

    admin.groupe.gerer:
        class: App\Admin\GroupeAdmin
        arguments: [~, App\Entity\Groupe, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              label: "Groupes locaux"
        public: true

    admin.comptoir.gerer:
        class: App\Admin\ComptoirAdmin
        arguments: [~, App\Entity\Comptoir, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              label: "Comptoirs"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.groupepresta.gerer:
        class: App\Admin\GroupeprestataireAdmin
        arguments: [~, App\Entity\Groupeprestataire, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Prestataire"
              label: "AMAP / Marchés"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.etatpresta.gerer:
        class: App\Admin\EtatprestataireAdmin
        arguments: [~, App\Entity\EtatPrestataire, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Prestataire"
              label: "Tags"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.news.gerer:
        class: App\Admin\NewsAdmin
        arguments: [~, App\Entity\News, 'PixSortableBehaviorBundle:SortableAdmin']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Contenu"
              label: "Actualités"
        public: true

    admin.globalparameter.gerer:
        class: App\Admin\GlobalParameterAdmin
        arguments: [~, App\Entity\GlobalParameter, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Contenu"
              label: "Configuration"
        public: true

    admin.document.gerer:
        class: App\Admin\DocumentAdmin
        arguments: [~, App\Entity\Document, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Contenu"
              label: "Documents"
        public: true

    admin.rubrique.gerer:
        class: App\Admin\RubriqueAdmin
        arguments: [~, App\Entity\Rubrique, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Contenu"
              label: "Rubriques"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.faq.gerer:
        class: App\Admin\FaqAdmin
        arguments: [~, App\Entity\Faq, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Contenu"
              label: "FAQs"
        public: true

    admin.traduction.gerer:
        class: App\Admin\TraductionAdmin
        arguments: [~, Lexik\Bundle\TranslationBundle\Entity\Translation, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Traduction"
              label: "Traductions"
        public: true

    admin.flux.gerer:
        class: App\Admin\FluxAdmin
        arguments: [~, App\Entity\Flux, 'App\Controller\CRUD\CRUDController']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Flux"
              pager_type: "simple"
        public: true
        calls:
            - [ setSubClasses, [{transaction: 'App\Entity\Transaction', transfert: 'App\Entity\Transfert', cotisation: 'App\Entity\Cotisation', achat_monnaie: 'App\Entity\AchatMonnaie'}]]
            - [ setSecurity, ['@security.helper']]

    admin.operation.gerer:
        class: App\Admin\OperationAdmin
        arguments: [~, App\Entity\Operation, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Operation"
              label: "Operation"
              pager_type: "simple"
        public: true
        calls:
            - [ setSubClasses, [{adherent: 'App\Entity\OperationAdherent', prestataire: 'App\Entity\OperationPrestataire', comptoir: 'App\Entity\OperationComptoir', groupe: 'App\Entity\OperationGroupe', siege: 'App\Entity\OperationSiege'}]]
            - [ setSecurity, ['@security.helper']]

    admin.operation.prestataire.gerer:
        class: App\Admin\OperationPrestataireAdmin
        arguments: [~, App\Entity\OperationPrestataire, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Operations"
              label: "Prestataires"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.operation.adherent.gerer:
        class: App\Admin\OperationAdherentAdmin
        arguments: [~, App\Entity\OperationAdherent, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Operations"
              label: "Adherents"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.operation.groupe.gerer:
        class: App\Admin\OperationGroupeAdmin
        arguments: [~, App\Entity\OperationGroupe, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Operations"
              label: "Groupes"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.operation.comptoir.gerer:
        class: App\Admin\OperationComptoirAdmin
        arguments: [~, App\Entity\OperationComptoir, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Operations"
              label: "Comptoirs"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.operation.siege.gerer:
        class: App\Admin\OperationSiegeAdmin
        arguments: [~, App\Entity\OperationSiege, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Operations"
              label: "Siege"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.transfert.gerer:
        class: App\Admin\TransfertAdmin
        arguments: [~, App\Entity\Transfert, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Transferts"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]
            - [ setSession, ['@session']]

    admin.transaction.gerer:
        class: App\Admin\TransactionAdmin
        arguments: [~, App\Entity\Transaction, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Transactions"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.reconversion.gerer:
        class: App\Admin\ReconversionAdmin
        arguments: [~, App\Entity\Reconversion, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Reconversions"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.page.gerer:
        class: App\Admin\PageAdmin
        arguments: [~, App\Entity\Page, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Pages"
              label: "Pages"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.import:
        class: App\Admin\ImportAdmin
        arguments: [~, App\Entity\Import, App\Controller\ImportController]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Import"
              label: "Import"
              show_mosaic_button: false
        public: true

    admin.solidoume:
        class: App\Admin\SolidoumeAdmin
        arguments: [~, App\Entity\SolidoumeItem, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Solidoume"
              label: "Solidoume"
              show_mosaic_button: false
        public: true
    
    admin.solidoume.parameters:
        class: App\Admin\SolidoumeParamAdmin
        arguments: [~, App\Entity\SolidoumeParameter, App\Controller\SolidoumeParameterController]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Paramètres Solidoume"
              label: "Paramètres Solidoume"

    admin.dons:
        class: App\Admin\DonAdmin
        arguments: [~, App\Entity\Don, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Flux"
              label: "Dons"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.helloasso:
        class: App\Admin\HelloAssoAdmin
        arguments: [~, App\Entity\HelloAsso, App\Controller\HelloAssoController]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "HelloAsso"
              label: "HelloAsso"
              show_mosaic_button: false
        public: true

    admin.productsFamily:
        class: App\Admin\ProductFamilyAdmin
        arguments: [~, App\Entity\ProductFamily, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Familles de Produits"
              label: "Familles de Produits"
        public: true

    admin.informationPopup:
        class: App\Admin\InformationPopupAdmin
        arguments: [~, App\Entity\InformationPopup, ~]
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "Popups d'information"
              label: "Popups d'information"
        public: true

    admin.thirdPartyFinancers:
        class: App\Admin\ThirdPartyFinancerAdmin
        arguments: [~, App\Entity\ThirdPartyFinancer, 'App\Controller\CRUD\CRUDController']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "thirdPartyFinancers"
              label: "Liste"
              pager_type: "simple"
        public: true
        calls:
            - [ setSecurity, ['@security.helper']]

    admin.thirdPartyAllocationFunding:
        class: App\Admin\ThirdPartyAllocationFundingAdmin
        arguments: [~, App\Entity\ThirdPartyAllocationFunding, 'App\Controller\CRUD\CRUDController']
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "thirdPartyFinancers"
              label: "Prises en charge"
              pager_type: "simple"
        public: true

    sonata.media.provider.csv:
        class: App\Admin\ImportProvider
        tags:
            - { name: sonata.media.provider }
        arguments:
            - 'sonata.media.provider.csv'
            - '@sonata.media.filesystem.local'
            - '@sonata.media.cdn.server'
            - '@sonata.media.generator.default'
            - '@sonata.media.thumbnail.format'
            - ['csv', 'txt']
            - ['text/csv', 'application/vnd.ms-excel', 'text/plain', 'text/x-csv', 'application/csv', 'text/comma-separated-values', 'text/x-comma-separated-values', 'text/tab-separated-values']
    # admin.flux.gerer:
    #     class: App\Admin\FluxAdmin
    #     arguments: [~, App\Entity\Transaction, ~]
    #     tags:
    #         - name: sonata.admin
    #           manager_type: orm
    #           group: "Comptabilité"
    #           label: "Flux"
    #     public: true

    app.flash_messenger:
        class: App\Listener\Flash
        arguments: ["@session"]
        tags:
            - { name: kernel.event_listener, event: kernel.response }

    App\Swagger\SwaggerDecorator:
        decorates: 'api_platform.swagger.normalizer.api_gateway'
        arguments: [ '@App\Swagger\SwaggerDecorator.inner' ]
        autoconfigure: false
    
    filter.configurator:
        class: App\Filter\Configurator
        arguments: ["@doctrine.orm.entity_manager"]
        tags:
            - { name: kernel.event_listener, event: kernel.controller }

    App\Serializer\ApiNormalizer:
        decorates: 'api_platform.serializer.normalizer.item'
        arguments: [ '@App\Serializer\ApiNormalizer.inner' ]

    # @TODO : A FINIR : si un adhérent ou un prestataire n'a pas sa cotisation à jour => redirection vers une page pour pouvoir :
    #   - cotiser
    #   - voir son ecompte
    #   
    # app.kernel.event.listener:    
    #     class: App\EventListener\RequestListener
    #     arguments: ['@doctrine.orm.entity_manager', '@security.token_storage', '@router']
    #     tags:
    #         - { name: 'kernel.event_listener', event: 'kernel.request', method: 'onKernelRequest' }

    ambta_doctrine_encrypt.orm_subscriber:
        class: Ambta\DoctrineEncryptBundle\Subscribers\DoctrineEncryptSubscriber
        arguments: ["@annotation_reader", "%ambta_doctrine_encrypt.encryptor_class_name%"]
        tags:
            -  { name: doctrine.event_subscriber }
    ambta_doctrine_encrypt.subscriber:
        public: true
        alias: ambta_doctrine_encrypt.orm_subscriber
    ambta_doctrine_encrypt.encryptor:
        class: Ambta\DoctrineEncryptBundle\Services\Encryptor

    Ambta\DoctrineEncryptBundle\Command\DoctrineEncryptStatusCommand:
        public: false
        tags:
            - { name: console.command, command: 'doctrine:encrypt:status' }

    Doctrine\Migrations\Version\DbalMigrationFactory: ~
    App\Utils\MigrationFactoryDecorator:
        decorates: Doctrine\Migrations\Version\DbalMigrationFactory
        arguments: ['@App\Utils\MigrationFactoryDecorator.inner', '@service_container']

    # To fix this error : 
    # In ModelManager.php line 627:
    # Cannot initialize abstract class: App\Entity\AchatMonnaieAConfirmer
    App\Command\TranslationUpdateCommand:
      arguments:
        - '@translation.writer'
        - '@translation.reader'
        - '@translation.extractor'
        - '%kernel.default_locale%'
        - '%translator.default_path%'
        - ''
        - []
        - []
      decorates: console.command.translation_update
      class: App\Command\TranslationUpdateCommand

    app.menu_listener:
        class: App\EventListener\MenuBuilderListener
        tags:
            - { name: kernel.event_listener, event: sonata.admin.event.configure.menu.sidebar, method: addMenuItems }

    App\EventListener\LoginListener:
        arguments:
            - '@session'
        tags:
            - { name: 'kernel.event_listener', event: 'security.interactive_login' }