/** * Types for Supabase-backed dosha calculation (Lovable / celestial-puja-finder compatible). */ /** Payload sent to the calculate-dosha Edge Function */ export interface DoshaSubmissionPayload { name: string; gender: 'M' | 'F'; date: string; time?: string; unknownTime?: boolean; tz: string; lat: number; lon: number; place?: string; problemArea?: string; } /** Resolved place from host (e.g. Google Places) */ export interface ResolvedPlace { lat: number; lon: number; tz: string; /** Timezone offset in hours (e.g. 5.5 for IST). Required for Kundali chart when using built-in KundaliCard. */ tzoneOffset?: number; } /** Birth details for Kundali chart (same shape as celestial get-kundali-chart) */ export interface BirthDetails { day: number; month: number; year: number; hour: number; minute: number; lat: number; lon: number; tzone: number; } /** Summary returned by calculate-dosha */ export interface DoshaSummary { mangal?: string; kaalSarp?: string; pitra?: string; shaniSadeSati?: string; sadeSati?: string; sadeSatiPhase?: string; shaniPhase?: number | null; grahan?: string; shrapit?: string; guruChandal?: string; punarphoo?: string; kemadruma?: string; gandmool?: string; kalathra?: string; vishDaridra?: string; ketuNaga?: string; navagrahaUmbrella?: string; [key: string]: unknown; } /** Single dosha detail */ export interface DoshaDetail { name?: string; status?: string; explanation?: string; remedies?: string; [key: string]: unknown; } /** Successful response from calculate-dosha */ export interface DoshaCalculationResult { success: true; summary: DoshaSummary; details: DoshaDetail[] | Record; chart?: unknown; calculationId?: string | null; metadata?: Record; } /** Error response from calculate-dosha */ export interface DoshaCalculationError { success: false; error: string; details?: Array<{ field?: string; message?: string; }>; } export type DoshaCalculationResponse = DoshaCalculationResult | DoshaCalculationError;