# 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/configuration.html#application-related-configuration
parameters:
  crawler_host: '%env(CRAWLER_HOST)%'
  crawler_secret: '%env(CRAWLER_SECRET)%'
  redis:
      host: '%env(CACHE_PRODUCTS_HOST)%'
      password: '%env(CACHE_PRODUCTS_PASSWORD)%'
      port: '%env(CACHE_PRODUCTS_PORT)%'
      database: '%env(CACHE_PRODUCTS_DATABASE)%'
  env(MONGODB_URL): ''
  env(MONGODB_DB): ''
  sitemap_directory: '%env(SITEMAP_DIRECTORY)%'
  criteo_directory: '%env(CRITEO_DIRECTORY)%'
  google_merchant_directory: '%env(GOOGLE_MERCHANT_DIRECTORY)%'
  sms_endpoint: '%env(SMS_ENDPOINT)%'
  sms_user: '%env(SMS_USER)%'
  sms_pass: '%env(SMS_PASS)%'
  sms_sender: '%env(SMS_SENDER)%'
  sms_country: '%env(SMS_COUNTRY)%'
  sms_message: '%env(SMS_MESSAGE)%'
  NI_APIKEY: '%env(NI_APIKEY)%'
  NI_OUTLETID: '%env(NI_OUTLETID)%'
  NI_ENDPOINT: '%env(NI_ENDPOINT)%'
  NI_OPENID_AUTH_ENDPOINT: '%env(NI_OPENID_AUTH_ENDPOINT)%'
  NI_REALMNAME: '%env(NI_REALMNAME)%'
  MAXMIND_ACCOUNT_NO: '%env(MAXMIND_ACCOUNT_NO)%'
  MAXMIND_ACCOUNT_TOKEN: '%env(MAXMIND_ACCOUNT_TOKEN)%'
  BIN_CODE_URL: '%env(BIN_CODE_URL)%'
  BIN_CODE_API_KEY: '%env(BIN_CODE_API_KEY)%'
  PLATFROM_API_URL: '%env(PLATFROM_API_URL)%'
  SITE_URL: '%env(SITE_URL)%'
  PAYTABS_ENDPOINT: '%env(PAYTABS_ENDPOINT)%'
  PAYTABS_SERVER_KEY: '%env(PAYTABS_SERVER_KEY)%'
  PAYTABS_PROFILE_ID: '%env(PAYTABS_PROFILE_ID)%'
  MAGNATI_URL: '%env(MAGNATI_URL)%'
  MAGNATI_MERCHANT_ID: '%env(MAGNATI_MERCHANT_ID)%'
  MAGNATI_USERNAME: '%env(MAGNATI_USERNAME)%'
  MAGNATI_PASSWORD: '%env(MAGNATI_PASSWORD)%'
  NI_PROVIDER: '%env(NI_PROVIDER)%'
  PAYTABS_PROVIDER: '%env(PAYTABS_PROVIDER)%'
  BANK_PROVIDER: '%env(BANK_PROVIDER)%'
  MAGNATI_PROVIDER: '%env(MAGNATI_PROVIDER)%'
  DEFAULT_PAYMENT_PROVIDER: '%env(DEFAULT_PAYMENT_PROVIDER)%'

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/*'
    exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.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']

  monolog.logger.api:
    class: Psr\Log\LoggerInterface

  App\Event\ExceptionListener:
    arguments:
      - '@monolog.logger.api'
    tags:
      - { name: kernel.event_listener, event: kernel.exception, method: onKernelException }
  # add more service definitions when explicit configuration is needed
  # please note that last definitions always *replace* previous ones

  Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler:
    arguments:
      - '@=service("doctrine_mongodb").getManager().getClient()'
      - { database: '%env(MONGODB_DB)%', collection: '%env(MONGODB_SESSION_COLLECTION)%' }

  App\Service\ApiService:
    arguments:
      - {base_uri: '%env(API_BASE_URL)%', http_errors: false, verify: false}

  App\Service\CartService:
    arguments:
      - '@=service("doctrine_mongodb").getManager()'

  SendGrid\Mail\Mail:
    autowire: true
