parameters:
    locale: en
    # can be regenerated with: bin/console kimai:reset:locales
    kimai_locales: ['ar', 'bg', 'cs', 'da', 'de', 'de_CH', 'el', 'en', 'eo', 'es', 'eu', 'fa', 'fi', 'fo', 'fr', 'he', 'hr', 'hu', 'id', 'it', 'ja', 'ko', 'nb_NO', 'nl', 'pa', 'pl', 'pt', 'pt_BR', 'ro', 'ru', 'sk', 'sl', 'sv', 'ta', 'tr', 'uk', 'vi', 'zh_CN', 'zh_Hant', 'zh_Hant_TW', '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_CZ', 'en_DE', 'en_DG', 'en_DK', 'en_DM', 'en_ER', 'en_ES', 'en_FI', 'en_FJ', 'en_FK', 'en_FM', 'en_FR', 'en_GB', 'en_GD', 'en_GG', 'en_GH', 'en_GI', 'en_GM', 'en_GS', 'en_GU', 'en_GY', 'en_HK', 'en_HU', 'en_ID', 'en_IE', 'en_IL', 'en_IM', 'en_IN', 'en_IO', 'en_IT', '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_NH', 'en_NL', 'en_NO', 'en_NR', 'en_NU', 'en_NZ', 'en_PG', 'en_PH', 'en_PK', 'en_PL', 'en_PN', 'en_PR', 'en_PT', 'en_PW', 'en_RH', 'en_RO', 'en_RW', 'en_SB', 'en_SC', 'en_SD', 'en_SE', 'en_SG', 'en_SH', 'en_SI', 'en_SK', '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_EA', 'es_EC', 'es_ES', 'es_GQ', 'es_GT', 'es_HN', 'es_IC', '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_CN', 'ko_KP', 'ko_KR', 'nl_AW', 'nl_BE', 'nl_BQ', 'nl_CW', 'nl_NL', 'nl_SR', 'nl_SX', 'pl_PL', 'pt_AO', 'pt_BR', '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', 'uk_UA', 'vi_VN']

services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true
        autoconfigure: true
        public: false
        bind:
            $projectDirectory: '%kernel.project_dir%'
            $kernelEnvironment: '%kernel.environment%'

    # 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/API/Model/'
            - '../src/DependencyInjection/'
            - '../src/Doctrine/Extensions/'
            - '../src/Entity/'
            - '../src/Event/'
            - '../src/Export/Package/'
            - '../src/Export/Base/'
            - '../src/Form/Model/'
            - '../src/Model/'
            - '../src/Repository/Loader/'
            - '../src/Repository/Paginator/'
            - '../src/Repository/Query/'
            - '../src/Repository/Result/'
            - '../src/WorkingTime/Calculator/'
            - '../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\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'

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

    App\Timesheet\RoundingService:
        arguments:
            # this is currently required, as local.yaml allows to configure several rules,
            # while the database system only allows one rounding rule
            $rules: '%kimai.timesheet.rounding%'

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

    App\Timesheet\RateCalculator\RateCalculatorMode:
        factory: ['@App\Timesheet\RateCalculator\RateCalculatorFactory', getRateCalculatorMode]

    # ================================================================================
    # 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:
            $userProvider: '@security.user.provider.concrete.kimai_internal'
            $configuration: '@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']

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

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

    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"

    App\API\ViewHandler:
        arguments: ['@fos_rest.view_handler.default']
