# yaml-language-server: $schema=../vendor/symfony/dependency-injection/Loader/schema/services.schema.json

parameters:
    app.match_cote_mode_default: 'one_n_two'
    app.match_cote_mode: '%env(default:app.match_cote_mode_default:MATCH_COTE_MODE)%'
    app.competition_start_at: '%env(default::COMPETITION_START_AT)%'
    app.cotisation_wire_phone: '%env(default::COTISATION_WIRE_PHONE)%'
    app.image_upload.webp_quality: 82
    app.image_upload.jpeg_quality: 85
    app.image_upload.png_compression: 8
    env(VAPID_PUBLIC_KEY): ''
    env(VAPID_PRIVATE_KEY): ''
    env(VAPID_SUBJECT): ''
    env(API_FOOTBALL_PLAYERS_PROFILE_ENRICH_BATCH_SIZE): '1'
    env(API_FOOTBALL_SQUAD_MAX_PLAYERS): '26'
    app.admin_notification_email_default: 'guigui@lotopotofoot.fr'
    app.admin_registration_notification_emails_default: 'guigui@lotopotofoot.fr,guillaume.bex44@gmail.com'
    app.badges_enabled_default: false
    app.badges_enabled: '%env(bool:default:app.badges_enabled_default:BADGES_ENABLED)%'
    app.badges_ironic_enabled_default: true
    app.badges_ironic_enabled: '%env(bool:default:app.badges_ironic_enabled_default:BADGES_IRONIC_ENABLED)%'
    app.badges_admin_only_default: false
    app.badges_admin_only: '%env(bool:default:app.badges_admin_only_default:BADGES_ADMIN_ONLY)%'
    app.vapid_public_key: '%env(VAPID_PUBLIC_KEY)%'
    app.vapid_private_key: '%env(VAPID_PRIVATE_KEY)%'
    app.vapid_subject: '%env(VAPID_SUBJECT)%'

services:
    _defaults:
        autowire: true
        autoconfigure: true

    App\:
        resource: '../src/'
        exclude:
            - '../src/DependencyInjection/'
            - '../src/Entity/'
            - '../src/Kernel.php'

    App\Service\CompetitionStatus:
        arguments:
            $competitionStartAt: '%app.competition_start_at%'

    App\Service\BadgeFeature:
        arguments:
            $badgesEnabled: '%app.badges_enabled%'
            $badgesIronicEnabled: '%app.badges_ironic_enabled%'
            $badgesAdminOnly: '%app.badges_admin_only%'

    App\Service\WebPushService:
        arguments:
            $vapidPublicKey: '%app.vapid_public_key%'
            $vapidPrivateKey: '%app.vapid_private_key%'
            $vapidSubject: '%app.vapid_subject%'

    App\Command\PushTestSendCommand:
        arguments:
            $vapidPublicKey: '%app.vapid_public_key%'
            $vapidPrivateKey: '%app.vapid_private_key%'
            $vapidSubject: '%app.vapid_subject%'

    App\Service\ApiFootballClient:
        arguments:
            $apiKey: '%env(default::API_FOOTBALL_KEY)%'
            $playerSyncStop: '@App\Service\ApiFootballPlayerSyncStop'
            $requestDelayMs: '%env(int:API_FOOTBALL_REQUEST_DELAY_MS)%'

    App\Service\ApiFootballPlayerSyncStop:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Service\RemoteImageStorage:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Service\ImageUploadOptimizer:
        arguments:
            $projectDir: '%kernel.project_dir%'
            $webpQuality: '%app.image_upload.webp_quality%'
            $jpegQuality: '%app.image_upload.jpeg_quality%'
            $pngCompression: '%app.image_upload.png_compression%'

    App\Service\UploadedImageStorage:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Service\PageBannerResolver:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Service\LiveMatchSyncService:
        arguments:
            $liveSyncEnabled: '%env(bool:API_FOOTBALL_LIVE_SYNC_ENABLED)%'
            $lookaheadMinutes: '%env(int:API_FOOTBALL_LIVE_SYNC_LOOKAHEAD_MINUTES)%'
            $graceAfterKickoffMinutes: '%env(int:API_FOOTBALL_LIVE_SYNC_GRACE_MINUTES)%'

    App\Controller\CronController:
        arguments:
            $cronSecret: '%env(default::CRON_SECRET)%'

    App\Service\ApiFootballPlayerBatchSyncState:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Service\ApiFootballPlayerProfileEnrichBatchSyncState:
        arguments:
            $projectDir: '%kernel.project_dir%'

    App\Service\AdminActivityNotifier:
        arguments:
            $adminNotificationEmail: '%env(default:app.admin_notification_email_default:ADMIN_NOTIFICATION_EMAIL)%'
            $adminRegistrationNotificationEmails: '%env(default:app.admin_registration_notification_emails_default:ADMIN_REGISTRATION_NOTIFICATION_EMAILS)%'

    App\Service\Wc2026SyncService:
        arguments:
            $apiFootballWorldCupLeagueId: '%env(int:API_FOOTBALL_WC_LEAGUE_ID)%'
            $apiFootballWorldCupSeason: '%env(int:API_FOOTBALL_WC_SEASON)%'
            $apiFootballSyncGoalsMaxRequests: '%env(int:API_FOOTBALL_SYNC_GOALS_MAX_REQUESTS)%'
            $apiFootballPlayersProfileEnrichMaxCallsPerBatch: '%env(int:API_FOOTBALL_PLAYERS_PROFILE_ENRICH_MAX_CALLS_PER_BATCH)%'
            $apiFootballSquadMaxPlayers: '%env(int:API_FOOTBALL_SQUAD_MAX_PLAYERS)%'

    App\Controller\Admin\DashboardController:
        arguments:
            $apiFootballSyncMaxRequests: '%env(int:API_FOOTBALL_SYNC_MAX_REQUESTS)%'
            $apiFootballPlayersSyncBatchSize: '%env(int:API_FOOTBALL_PLAYERS_SYNC_BATCH_SIZE)%'
            $apiFootballPlayersProfileEnrichBatchSize: '%env(int:API_FOOTBALL_PLAYERS_PROFILE_ENRICH_BATCH_SIZE)%'
            $apiFootballPlayersProfileEnrichMaxCallsPerBatch: '%env(int:API_FOOTBALL_PLAYERS_PROFILE_ENRICH_MAX_CALLS_PER_BATCH)%'

    # EasyAdmin instancie chaque CRUD via le conteneur ; sans entrée explicite, le cache prod
    # génère `new UserCrudController()` sans argument (ArgumentCountError sur toute page admin).
    App\Controller\Admin\UserCrudController:
        arguments:
            $passwordHasher: '@security.user_password_hasher'
            $uploadedImageFinalize: '@App\Service\UploadedImageFinalizeService'

    App\Mailer\Transport\PhpMailTransportFactory:
        tags: ['mailer.transport_factory']

    App\Command\Wc2026SyncCommand:
        arguments:
            $syncService: '@App\Service\Wc2026SyncService'
            $defaultPlayersSyncMaxRequests: '%env(int:API_FOOTBALL_SYNC_MAX_REQUESTS)%'
