/** * Pricing Resolver — Source of Truth * * Reads real data from Supabase. Never guesses, never hardcodes. * Each host owns their own pricing via their property node. * * Pricing flow: * public_total = sum of nightly rates (season × guest level × day type) * federation_total = public_total on the MCP/agent path (P1 — matches signed offer) * gap_total = federation_total × (1 - gap_night_discount_pct / 100) * * Acquisition discount source: `property_channel_discounts` (agent channel), then * legacy `properties.direct_booking_discount`. Under P1 (smart-stays ADR 2026-06-25) * configured discounts are read for parity with the dashboard but NOT applied until P2. * (only when calendar context shows a gap) * * RULES (synced with main repo pricing-resolver.ts): * - Weekend = Friday + Saturday. Sunday is NEVER weekend. * - Week package = exactly 7 nights (not 8). * - Two-week package = exactly 14 nights. * - Package pricing only when ALL nights are same season type. * - Guest block = staircase: smallest block whose guest count >= requested. * - Gap discount reads from property_smart_pricing.gap_night_discount_pct. */ import { SupabaseClient } from "@supabase/supabase-js"; export interface PriceBlock { guests: number; low_weekday: number; low_weekend: number; high_weekday: number; high_weekend: number; low_week: number | null; high_week: number | null; low_two_weeks: number | null; high_two_weeks: number | null; } export interface Season { name: string; date_from: string; date_to: string; type: "high" | "low"; } export interface QuoteResult { propertyId: string; checkIn: string; checkOut: string; guests: number; nights: number; currency: string; breakdown: { nightlyRates: { date: string; rate: number; season: string; dayType: string; }[]; }; publicTotal: number; federationTotal: number; federationDiscountPercent: number; packageApplied: string | null; gapNight: boolean; gapTotal: number | null; gapDiscountPercent: number | null; } export declare function daysBetween(checkIn: string, checkOut: string): number; /** Weekend = Friday (5) + Saturday (6). Sunday is NEVER weekend. */ export declare function isWeekend(dateStr: string): boolean; /** * Staircase pricing: find the smallest block whose guest count >= requested. * Example: blocks [2, 6] — 2 guests → 2g, 3-6 guests → 6g, 1 guest → 2g. * Returns null only if guests > all blocks (handled by max_guests check upstream). */ export declare function findPriceBlock(guests: number, blocks: PriceBlock[]): PriceBlock | null; export declare function resolveQuote(supabase: SupabaseClient, propertyId: string, checkIn: string, checkOut: string, guests: number): Promise;