parameters:
    locale: en
    # the original list of all locales is the next line, it can be used to regenerate the locale list in case new locales will be added
    #app_locales: ar|cs|da|de|el|en|eo|es|eu|fa|fi|fo|fr|he|hr|hu|it|ja|ko|nb_NO|nl|pl|pt|ro|ru|sk|sv|tr|uk|vi|zh_CN|zh_Hant
    app_locales: ar|cs|da|de|el|en|eo|es|eu|fa|fi|fo|fr|he|hr|hu|it|ja|ko|nb_NO|nl|pl|pt|pt_BR|ro|ru|sk|sv|tr|uk|vi|zh_CN|zh_Hant|cs_CZ|da_DK|da_GL|de_AT|de_BE|de_CH|de_DE|de_IT|de_LI|de_LU|el_CY|el_GR|en_AE|en_AG|en_AI|en_AS|en_AT|en_AU|en_BB|en_BE|en_BI|en_BM|en_BS|en_BW|en_BZ|en_CA|en_CC|en_CH|en_CK|en_CM|en_CX|en_CY|en_DE|en_DK|en_DM|en_ER|en_FI|en_FJ|en_FK|en_FM|en_GB|en_GD|en_GG|en_GH|en_GI|en_GM|en_GU|en_GY|en_HK|en_IE|en_IL|en_IM|en_IN|en_IO|en_JE|en_JM|en_KE|en_KI|en_KN|en_KY|en_LC|en_LR|en_LS|en_MG|en_MH|en_MO|en_MP|en_MS|en_MT|en_MU|en_MV|en_MW|en_MY|en_NA|en_NF|en_NG|en_NL|en_NR|en_NU|en_NZ|en_PG|en_PH|en_PK|en_PN|en_PR|en_PW|en_RW|en_SB|en_SC|en_SD|en_SE|en_SG|en_SH|en_SI|en_SL|en_SS|en_SX|en_SZ|en_TC|en_TK|en_TO|en_TT|en_TV|en_TZ|en_UG|en_UM|en_US|en_VC|en_VG|en_VI|en_VU|en_WS|en_ZA|en_ZM|en_ZW|es_AR|es_BO|es_BR|es_BZ|es_CL|es_CO|es_CR|es_CU|es_DO|es_EC|es_ES|es_GQ|es_GT|es_HN|es_MX|es_NI|es_PA|es_PE|es_PH|es_PR|es_PY|es_SV|es_US|es_UY|es_VE|eu_ES|fa_AF|fa_IR|fi_FI|fo_DK|fo_FO|fr_BE|fr_BF|fr_BI|fr_BJ|fr_BL|fr_CA|fr_CD|fr_CF|fr_CG|fr_CH|fr_CI|fr_CM|fr_DJ|fr_DZ|fr_FR|fr_GA|fr_GF|fr_GN|fr_GP|fr_GQ|fr_HT|fr_KM|fr_LU|fr_MA|fr_MC|fr_MF|fr_MG|fr_ML|fr_MQ|fr_MR|fr_MU|fr_NC|fr_NE|fr_PF|fr_PM|fr_RE|fr_RW|fr_SC|fr_SN|fr_SY|fr_TD|fr_TG|fr_TN|fr_VU|fr_WF|fr_YT|he_IL|hr_BA|hr_HR|hu_HU|it_CH|it_IT|it_SM|it_VA|ja_JP|ko_KP|ko_KR|nl_AW|nl_BE|nl_BQ|nl_CW|nl_NL|nl_SR|nl_SX|pl_PL|pt_AO|pt_CH|pt_CV|pt_GQ|pt_GW|pt_LU|pt_MO|pt_MZ|pt_PT|pt_ST|pt_TL|ro_MD|ro_RO|ru_BY|ru_KG|ru_KZ|ru_MD|ru_RU|ru_UA|sk_SK|sv_AX|sv_FI|sv_SE|tr_CY|tr_TR|vi_VN

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.
        public: false       # Allows optimizing the container by removing unused services; this also means
                            # fetching services directly from the container via $container->get() won't work.
                            # The best practice is to be explicit about your dependencies anyway.
        bind:
            $projectDirectory: '%kernel.project_dir%'
            $kernelEnvironment: '%kernel.environment%'

    # make classes in src/ available to be used as services
    # creates one service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/*'
        exclude:
            - '../src/API/Model/'
            - '../src/DependencyInjection/'
            - '../src/Entity/'
            - '../src/Repository/Loader/'
            - '../src/Repository/Paginator/'
            - '../src/Repository/Query/'
            - '../src/Repository/Result/'
            - '../src/Event/'
            - '../src/Model/'
            - '../src/Kernel.php'
            - '../src/Constants.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']

    # ================================================================================
    # APPLICATION CORE
    # ================================================================================

    security.user.provider.chain:
        class: App\Security\KimaiUserProvider

    App\Configuration\MailConfiguration:
        arguments: ['%env(MAILER_FROM)%']

    App\Configuration\LocaleService:
        arguments: ['%kimai.languages%']

    App\Configuration\SystemConfiguration:
        arguments:
            $settings: '%kimai.config%'

    App\Pdf\MPdfConverter:
        arguments:
            $cacheDirectory: '%kernel.cache_dir%'

    App\Plugin\PluginManager:
        arguments: [!tagged kimai.plugin]

    App\Validator\Constraints\TimesheetValidator:
        arguments: [!tagged timesheet.validator]

    App\Validator\Constraints\ProjectValidator:
        arguments: [!tagged project.validator]
        
    App\Validator\Constraints\QuickEntryTimesheetValidator:
        arguments: [!tagged timesheet.validator]

    App\Utils\FileHelper:
        arguments:
            $dataDir: '%kimai.data_dir%'

    App\API\Serializer\ValidationFailedExceptionErrorHandler:
        arguments: ['@translator.default', '@fos_rest.serializer.flatten_exception_handler']

    App\Command\ExportCreateCommand:
        arguments:
            $mailer: '@App\Mail\KimaiMailer'

    # ================================================================================
    # DATABASE
    # ================================================================================

    # updates timesheet records and apply configured rate & rounding rules
    App\Doctrine\TimesheetSubscriber:
        class: App\Doctrine\TimesheetSubscriber
        arguments: [!tagged timesheet.calculator]

    # updates timestampable columns (higher priority, so the TimesheetSubscriber will be executed later)
    App\Doctrine\ModifiedSubscriber:
        class: App\Doctrine\ModifiedSubscriber

    # ================================================================================
    # TIMESHEET RECORD CALCULATOR
    # ================================================================================

    App\Timesheet\RoundingService:
        arguments:
            $roundingModes: !tagged timesheet.rounding_mode
            $rules: '%kimai.timesheet.rounding%'

    App\Timesheet\RateService:
        arguments: ['%kimai.timesheet.rates%']

    App\Timesheet\TrackingModeService:
        arguments: 
            $modes: !tagged timesheet.tracking_mode

    # ================================================================================
    # SECURITY & VOTER
    # ================================================================================

    App\Security\RoleService:
        arguments:
            $roles: '%kimai.permission_roles%'

    App\Security\RolePermissionManager:
        arguments:
            $permissions: '%kimai.permissions%'
            $permissionNames: '%kimai.permission_names%'

    # ================================================================================
    # SAML Services
    # ================================================================================
    App\Saml\SamlProvider:
        arguments: ['@App\Repository\UserRepository', '@security.user.provider.concrete.kimai_internal', '@App\Configuration\SamlConfigurationInterface']

    # ================================================================================
    # REPOSITORIES
    # ================================================================================

    App\Repository\TimesheetRepository:
        class:     App\Repository\TimesheetRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Timesheet']

    App\Repository\UserRepository:
        class:     App\Repository\UserRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\User']

    App\Repository\TeamRepository:
        class:     App\Repository\TeamRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Team']

    App\Repository\ActivityRepository:
        class:     App\Repository\ActivityRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Activity']

    App\Repository\ProjectRepository:
        class:     App\Repository\ProjectRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Project']

    App\Repository\TagRepository:
        class:     App\Repository\TagRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Tag']

    App\Repository\CustomerRepository:
        class:     App\Repository\CustomerRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Customer']

    App\Repository\InvoiceTemplateRepository:
        class:     App\Repository\InvoiceTemplateRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\InvoiceTemplate']

    App\Repository\ConfigurationRepository:
        class:     App\Repository\ConfigurationRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Configuration']

    App\Repository\RoleRepository:
        class:     App\Repository\RoleRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Role']

    App\Repository\RolePermissionRepository:
        class:     App\Repository\RolePermissionRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\RolePermission']
    
    App\Repository\InvoiceDocumentRepository:
        class: App\Repository\InvoiceDocumentRepository
        arguments: ['%kimai.invoice.documents%']

    App\Repository\CustomerRateRepository:
        class:     App\Repository\CustomerRateRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\CustomerRate']

    App\Repository\ActivityRateRepository:
        class:     App\Repository\ActivityRateRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\ActivityRate']

    App\Repository\ProjectRateRepository:
        class:     App\Repository\ProjectRateRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\ProjectRate']

    App\Repository\InvoiceRepository:
        class:     App\Repository\InvoiceRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Invoice']

    App\Repository\BookmarkRepository:
        class:     App\Repository\BookmarkRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\Bookmark']

    App\Repository\WorkingTimeRepository:
        class:     App\Repository\WorkingTimeRepository
        factory:   ['@doctrine.orm.entity_manager', getRepository]
        arguments: ['App\Entity\WorkingTime']

    monolog.formatter.kimai:
        class: Monolog\Formatter\LineFormatter
        arguments:
            - "[%%datetime%%] [%%extra.channel%%] %%level_name%%: %%message%% %%context%% %%extra%%\n"
            - "Y-m-d H:i:s"

    monolog.formatter.deprecation:
        class: Monolog\Formatter\LineFormatter
        arguments:
            - "[%%datetime%%] %%message%% %%context%%\n"
            - "Y-m-d H:i:s"
