const LITELLM_STT_MODELS = ['local-whisper-large-v3-turbo', 'local-whisper-large-v3', 'local-parakeet-v3', 'local-whisper-1', 'gemini-2.0-flash', 'gemini-2.5-flash'];

function getSTTDependencies() {
  var { litellmClient } = require('./ai');
  return {
    litellm: !!litellmClient
  };
}

function getSTTProvider(deps) {
  var env = process.env.TRANSCRIBE_PROVIDER || 'auto';
  if (env === 'litellm') return 'litellm';

  var configured = deps || getSTTDependencies();
  if (configured.litellm) return 'litellm';
  return 'none';
}

function getSTTModelLists() {
  return {
    litellm: LITELLM_STT_MODELS
  };
}

function isLiteLLMSTTModel(model) {
  var mode = model && model.model_info && model.model_info.mode ? String(model.model_info.mode) : '';
  return mode === 'audio_transcription';
}

function getLiteLLMSTTModels(models) {
  return (models || [])
    .filter(isLiteLLMSTTModel)
    .map(function(model) { return model && (model.id || model.model_name) ? (model.id || model.model_name) : String(model || ''); });
}

module.exports = {
  LITELLM_STT_MODELS,
  getSTTDependencies,
  getLiteLLMSTTModels,
  getSTTModelLists,
  getSTTProvider,
  isLiteLLMSTTModel
};
