import apiClient from './client'; // Types export interface GiftTariffPeriod { days: number; price_kopeks: number; price_label: string; original_price_kopeks: number | null; discount_percent: number | null; } export interface GiftTariff { id: number; name: string; description: string | null; traffic_limit_gb: number; device_limit: number; periods: GiftTariffPeriod[]; } export interface GiftPaymentMethodSubOption { id: string; name: string; } export interface GiftPaymentMethod { method_id: string; display_name: string; description: string | null; icon_url: string | null; min_amount_kopeks: number | null; max_amount_kopeks: number | null; sub_options: GiftPaymentMethodSubOption[] | null; } export interface GiftConfig { is_enabled: boolean; tariffs: GiftTariff[]; payment_methods: GiftPaymentMethod[]; balance_kopeks: number; currency_symbol: string; } export interface GiftPurchaseRequest { tariff_id: number; period_days: number; recipient_type: 'email' | 'telegram'; recipient_value: string; gift_message?: string; payment_mode: 'balance' | 'gateway'; payment_method?: string; } export interface GiftPurchaseResponse { status: string; purchase_token: string; payment_url: string | null; } export interface GiftPurchaseStatus { status: string; is_gift: boolean; recipient_contact_value: string | null; gift_message: string | null; tariff_name: string | null; period_days: number | null; } // API export const giftApi = { getConfig: async (): Promise => { const { data } = await apiClient.get('/cabinet/gift/config'); return data; }, createPurchase: async (request: GiftPurchaseRequest): Promise => { const { data } = await apiClient.post('/cabinet/gift/purchase', request); return data; }, getPurchaseStatus: async (token: string): Promise => { const { data } = await apiClient.get(`/cabinet/gift/purchase/${token}`); return data; }, };