/**
 * Публичные (без auth) API-вызовы: тарифная сетка для страницы цен.
 */
export interface PricingTierDto {
    tier_no: number;
    leads_in_tier: number | null;
    price_rub: string;
}

export async function fetchPublicPricing(): Promise<PricingTierDto[]> {
    const res = await fetch('/api/public/pricing', { headers: { Accept: 'application/json' } });
    if (!res.ok) throw new Error(`pricing fetch failed: ${res.status}`);
    const data = (await res.json()) as { tiers: PricingTierDto[] };
    return data.tiers;
}
