{{{
  exports({
    to: app.configPath('translation.ts')
  })
}}}
import env from '#start/env'
import { defineConfig } from '@mixxtor/adonisjs-translader'
import type { InferProviders } from '@mixxtor/adonisjs-translader'
import { GoogleTranslateFreeProvider, GoogleTranslatePaidProvider } from '@mixxtor/translader'

const translationConfig = defineConfig({
  /*
  |--------------------------------------------------------------------------
  | Default Provider
  |--------------------------------------------------------------------------
  |
  | The default translation provider to use. This can be changed at runtime
  | using the `use()` method.
  |
  */
  default: env.get('TRANSLATION_PROVIDER', 'google-free') as 'google-free' | 'google-paid',

  /*
  |--------------------------------------------------------------------------
  | Provider Configurations
  |--------------------------------------------------------------------------
  |
  | Configure your translation providers here. You can add as many providers
  | as you need and switch between them at runtime.
  |
  */
  providers: {
    /*
    |--------------------------------------------------------------------------
    | Google Translate Free
    |--------------------------------------------------------------------------
    |
    | Free translation using Google Translate (unofficial API).
    | No API key required, but has rate limits.
    |
    */
    'google-free': new GoogleTranslateFreeProvider(),

    /*
    |--------------------------------------------------------------------------
    | Google Translate Paid (Cloud Translation API)
    |--------------------------------------------------------------------------
    |
    | Official Google Cloud Translation API with higher limits and better quality.
    | Requires API key or service account credentials.
    |
    | Setup guide: https://github.com/mixxtor/translader-js/blob/main/packages/translader/docs/GOOGLE-CLOUD-SETUP.md
    |
    */
    'google-paid': new GoogleTranslatePaidProvider({
      apiKey: env.get('GOOGLE_TRANSLATE_API_KEY'),
      // OR use service account:
      // credentials: {
      //   projectId: env.get('GOOGLE_CLOUD_PROJECT_ID'),
      //   privateKey: env.get('GOOGLE_CLOUD_PRIVATE_KEY'),
      //   clientEmail: env.get('GOOGLE_CLOUD_CLIENT_EMAIL'),
      // }
    }),

    /*
    |--------------------------------------------------------------------------
    | Custom Providers
    |--------------------------------------------------------------------------
    |
    | You can add more providers here as they become available:
    | - DeepL
    | - OpenAI
    | - Azure Translator
    | - etc.
    |
    */
  },
})

export default translationConfig

/*
|--------------------------------------------------------------------------
| Type Augmentation
|--------------------------------------------------------------------------
|
| Augment the container types to include the translation service.
| This provides better IntelliSense and type safety.
|
*/
declare module '@mixxtor/adonisjs-translader/types' {
  interface TranslationProviders extends InferProviders<typeof translationConfig> {}
}
