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

# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# See also https://symfony.com/doc/current/service_container/import.html

# 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.wupex.api_url: '%env(WUPEX_API_URL)%'
    app.wupex.api_key: '%env(WUPEX_API_KEY)%'
    app.wupex.merchant_code: '%env(WUPEX_MERCHANT_CODE)%'
    app.wupex.language: '%env(WUPEX_LANGUAGE)%'
    app.pricing.exchange_rate_api_url: '%env(EXCHANGE_RATE_API_URL)%'
    app.catalog.base_currency: '%env(CATALOG_BASE_CURRENCY)%'
    app.catalog.display_currency: '%env(CATALOG_DISPLAY_CURRENCY)%'
    app.catalog.manual_rate: '%env(float:CATALOG_MANUAL_RATE)%'
    app.catalog.auto_update_rate: '%env(bool:CATALOG_AUTO_UPDATE_RATE)%'
    app.catalog.commission_percent: '%env(float:CATALOG_COMMISSION_PERCENT)%'
    app.cinetpay.api_url: '%env(CINETPAY_API_URL)%'
    app.cinetpay.api_key: '%env(CINETPAY_APIKEY)%'
    app.cinetpay.site_id: '%env(CINETPAY_SITE_ID)%'
    app.cinetpay.api_password: '%env(CINETPAY_API_PASSWORD)%'
    app.cinetpay.seamless_api_url: '%env(CINETPAY_SEAMLESS_API_URL)%'
    app.cinetpay.currency: '%env(CINETPAY_CURRENCY)%'
    app.cinetpay.channels: '%env(CINETPAY_CHANNELS)%'
    app.cinetpay.lang: '%env(CINETPAY_LANG)%'
    app.loyalty.points_per_xof: '%env(float:LOYALTY_POINTS_PER_XOF)%'
    app.loyalty.referrer_bonus: '%env(int:LOYALTY_REFERRER_BONUS)%'
    app.loyalty.referee_bonus: '%env(int:LOYALTY_REFEREE_BONUS)%'
    app.mail.from_address: '%env(MAIL_FROM_ADDRESS)%'
    app.mail.from_name: '%env(MAIL_FROM_NAME)%'
    app.public_url: '%env(string:APP_PUBLIC_URL)%'

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/'

    App\Service\Wupex\WupexClient:
        arguments:
            $baseUrl: '%app.wupex.api_url%'
            $apiKey: '%app.wupex.api_key%'
            $merchantCode: '%app.wupex.merchant_code%'
            $language: '%app.wupex.language%'

    App\Service\Catalog\CatalogSyncService:
        arguments: {}

    App\Service\Pricing\ExchangeRateClient:
        arguments:
            $apiUrl: '%app.pricing.exchange_rate_api_url%'

    App\Service\Pricing\CatalogPricingService:
        arguments:
            $defaultBaseCurrency: '%app.catalog.base_currency%'
            $defaultDisplayCurrency: '%app.catalog.display_currency%'
            $defaultManualRate: '%app.catalog.manual_rate%'
            $defaultAutoUpdateRate: '%app.catalog.auto_update_rate%'
            $defaultCommissionPercent: '%app.catalog.commission_percent%'
            $defaultExchangeRateApiUrl: '%app.pricing.exchange_rate_api_url%'

    App\Service\Payment\CinetPayClient:
        arguments:
            $apiUrl: '%app.cinetpay.api_url%'
            $apiKey: '%app.cinetpay.api_key%'
            $siteId: '%app.cinetpay.site_id%'
            $apiPassword: '%app.cinetpay.api_password%'
            $seamlessApiUrl: '%app.cinetpay.seamless_api_url%'
            $defaultCurrency: '%app.cinetpay.currency%'
            $defaultChannels: '%app.cinetpay.channels%'
            $defaultLang: '%app.cinetpay.lang%'

    App\Service\Loyalty\LoyaltyService:
        arguments:
            $defaultPointsPerXof: '%app.loyalty.points_per_xof%'
            $defaultReferrerBonus: '%app.loyalty.referrer_bonus%'
            $defaultRefereeBonus: '%app.loyalty.referee_bonus%'

    App\Service\Delivery\OrderDeliveryMailer:
        arguments:
            $fromAddress: '%app.mail.from_address%'
            $fromName: '%app.mail.from_name%'

    App\Controller\CartController:
        arguments:
            $publicBaseUrl: '%app.public_url%'

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