# 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:
    app.defaultlocale: fr
    app.locales: [ en,fr ]
    app.locales.all: fr|en
    app.site.name: Baatela
    app.site.fullname: baatela.com
    app.site.tel: 0000000000
    app.site.email: contact@baatela.com
    app.site.address: 4 rue de flandre, 94230 Cachan France
    app.facebook.id: 989167664487167

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

    gedmo.mapping.driver.attribute:
        class: Gedmo\Mapping\Driver\AttributeReader

    # Doctrine Extension listeners to handle behaviors
    gedmo.listener.tree:
        class: Gedmo\Tree\TreeListener
        tags:
            - { name: doctrine.event_listener, event: 'prePersist'}
            - { name: doctrine.event_listener, event: 'preUpdate'}
            - { name: doctrine.event_listener, event: 'preRemove'}
            - { name: doctrine.event_listener, event: 'onFlush'}
            - { name: doctrine.event_listener, event: 'loadClassMetadata'}
            - { name: doctrine.event_listener, event: 'postPersist'}
            - { name: doctrine.event_listener, event: 'postUpdate'}
            - { name: doctrine.event_listener, event: 'postRemove'}
        calls:
            # Uncomment the below call if using attributes, and comment the call for the annotation reader
            # - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]
            # The `annotation_reader` service was deprecated in Symfony 6.4 and removed in Symfony 7.0
            - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]

    Gedmo\Translatable\TranslatableListener:
        tags:
            - { name: doctrine.event_listener, event: 'postLoad' }
            - { name: doctrine.event_listener, event: 'postPersist' }
            - { name: doctrine.event_listener, event: 'preFlush' }
            - { name: doctrine.event_listener, event: 'onFlush' }
            - { name: doctrine.event_listener, event: 'loadClassMetadata' }
        calls:
            # Uncomment the below call if using attributes, and comment the call for the annotation reader
            # - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]
            # The `annotation_reader` service was deprecated in Symfony 6.4 and removed in Symfony 7.0
            - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]

            - [ setDefaultLocale, [ "%app.defaultlocale%" ] ]
            - [ setTranslationFallback, [ false ] ]

    gedmo.listener.timestampable:
        class: Gedmo\Timestampable\TimestampableListener
        tags:
            - { name: doctrine.event_listener, event: 'prePersist' }
            - { name: doctrine.event_listener, event: 'onFlush' }
            - { name: doctrine.event_listener, event: 'loadClassMetadata' }
        calls:
            # Uncomment the below call if using attributes, and comment the call for the annotation reader
            # - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]
            # The `annotation_reader` service was deprecated in Symfony 6.4 and removed in Symfony 7.0
            - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]

    gedmo.listener.sluggable:
        class: Gedmo\Sluggable\SluggableListener
        tags:
            - { name: doctrine.event_listener, event: 'prePersist' }
            - { name: doctrine.event_listener, event: 'onFlush' }
            - { name: doctrine.event_listener, event: 'loadClassMetadata' }
        calls:
            # Uncomment the below call if using attributes, and comment the call for the annotation reader
            # - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]
            # The `annotation_reader` service was deprecated in Symfony 6.4 and removed in Symfony 7.0
            - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]

    gedmo.listener.sortable:
        class: Gedmo\Sortable\SortableListener
        tags:
            - { name: doctrine.event_listener, event: 'onFlush' }
            - { name: doctrine.event_listener, event: 'loadClassMetadata' }
            - { name: doctrine.event_listener, event: 'prePersist' }
            - { name: doctrine.event_listener, event: 'postPersist' }
            - { name: doctrine.event_listener, event: 'preUpdate' }
            - { name: doctrine.event_listener, event: 'postRemove' }
            - { name: doctrine.event_listener, event: 'postFlush' }
        calls:
            # Uncomment the below call if using attributes, and comment the call for the annotation reader
            # - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]
            # The `annotation_reader` service was deprecated in Symfony 6.4 and removed in Symfony 7.0
            - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]

    gedmo.listener.softdeleteable:
        class: Gedmo\SoftDeleteable\SoftDeleteableListener
        tags:
            - { name: doctrine.event_listener, event: 'onFlush' }
            - { name: doctrine.event_listener, event: 'loadClassMetadata' }
        calls:
            # Uncomment the below call if using attributes, and comment the call for the annotation reader
            # - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]
            # The `annotation_reader` service was deprecated in Symfony 6.4 and removed in Symfony 7.0
            - [ setAnnotationReader, [ "@gedmo.mapping.driver.attribute" ] ]


    App\:
        resource: '../src/'
        exclude:
            - '../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\State\UserPasswordHasher:
        bind:
            $processor: '@api_platform.doctrine.orm.state.persist_processor'

    App\State\SetUserProcessor:
        bind:
            $processor: '@api_platform.doctrine.orm.state.persist_processor'
    App\State\UserCreateProfilProcessor:
        bind:
            $processor: '@api_platform.doctrine.orm.state.persist_processor'
    App\State\UserCreateWorkshopProcessor:
        bind:
            $processor: '@api_platform.doctrine.orm.state.persist_processor'

    App\State\FromWorkshopCreateEmployeeProcessor:
        bind:
            $processor: '@api_platform.doctrine.orm.state.persist_processor'

    App\State\UserCreateClientProcessor:
        bind:
            $processor: '@api_platform.doctrine.orm.state.persist_processor'

    'App\Doctrine\CurrentUserExtension':
        tags:
            - { name: api_platform.doctrine.orm.query_extension.collection }
            - { name: api_platform.doctrine.orm.query_extension.item }

    App\EventListener\CreateSelfEmployedAfterCreateWorkshopListener:
        tags:
            - { name: doctrine.event_listener, event: postPersist, }

    App\EventListener\CreateDefaultStatusAfterCreateSewingorderListener:
        tags:
            - { name: doctrine.event_listener, event: postPersist, }

#    App\EventListener\UpdateSewingOrderStatusListener:
#        tags:
#            - { name: doctrine.event_listener, event: postPersist, }



        #arguments: [ '@Symfony\Component\Messenger\MessageBusInterface' ]

#    App\OpenApi\OpenApiFactory:
#        decorates: 'api_platform.openapi.factory'
#        arguments: [ '@App\OpenApi\OpenApiFactory.inner' ]
#        autoconfigure: false



