import client from './client'

export interface TelegramLinkToken {
  token: string
  bot_url: string
}

export interface TelegramStatus {
  telegram_id: number | null
  telegram_username: string | null
}

export const telegramApi = {
  generateLinkToken: async (): Promise<TelegramLinkToken> => {
    const response = await client.post<TelegramLinkToken>('/telegram/generate-link-token')
    return response.data
  },

  unlinkTelegram: async (): Promise<void> => {
    await client.post('/users/me/telegram/unlink')
  },
}
