export interface TelegramConfig {
  token: string
  chatId: string
}

export function loadConfig(overrides?: { chatId?: string }): TelegramConfig {
  const token = process.env.TELEGRAM_BOT_TOKEN
  if (!token) {
    throw new Error("TELEGRAM_BOT_TOKEN env var is required (see .env.example)")
  }

  const chatId = overrides?.chatId ?? process.env.TELEGRAM_CHAT_ID
  if (!chatId) {
    throw new Error("chat_id is required: pass --chat-id or set TELEGRAM_CHAT_ID env var")
  }

  return { token, chatId }
}