// ─── TypeScript types matching Supabase schema ───────────────── export type CompanyStatus = | "discovered" | "researching" | "profiled" | "qualified" | "nurture" | "archived" | "suppressed"; export type ContactStatus = | "found" | "email_verified" | "email_invalid" | "linkedin_only" | "suppressed"; export type LeadTier = "hot" | "warm" | "nurture" | "archive"; export type OutreachChannel = "email" | "linkedin"; export type OutreachStatus = | "queued" | "sent" | "opened" | "replied" | "bounced" | "failed" | "review_needed"; export type IntentType = | "interested" | "question" | "not_now" | "not_interested" | "out_of_office" | "wrong_person" | "unknown"; export type ReviewStatus = "pending" | "approved" | "rejected" | "edited"; // ─── Table row types ───────────────────────────────────────── export interface IcpConfig { id: string; name: string; min_employees: number; industries: string[]; exclude_industries: string[]; geographies: string[]; keywords: string[]; tech_signals: string[]; score_threshold: number; is_active: boolean; created_at: string; updated_at: string; } export interface RotationState { id: string; week_number: number; region: string; started_at: string; completed_at: string | null; companies_found: number; leads_qualified: number; } export interface Company { id: string; domain: string; name: string; industry: string | null; employee_count: number | null; employee_range: string | null; description: string | null; website_url: string | null; linkedin_url: string | null; country: string | null; region: string | null; tech_stack: string[]; growth_signals: GrowthSignal[]; raw_data: Record; source: string; status: CompanyStatus; discovered_at: string; updated_at: string; } export interface GrowthSignal { type: "job_posting" | "news" | "funding" | "social_post" | "expansion"; content: string; source_url?: string; ai_related: boolean; detected_at: string; } export interface Contact { id: string; company_id: string; full_name: string; first_name: string | null; last_name: string | null; title: string; seniority: "c_suite" | "vp" | "director" | "manager" | null; email: string | null; email_verified: boolean; email_source: "hunter" | "snov" | "pattern" | null; linkedin_url: string | null; linkedin_verified: boolean; status: ContactStatus; suppressed: boolean; suppressed_at: string | null; suppressed_reason: string | null; created_at: string; updated_at: string; } export interface Evidence { id: string; company_id: string; type: "job_posting" | "news" | "social_post" | "website_text" | "tech_stack"; content: string; source_url: string | null; ai_signal: boolean; collected_at: string; } export interface LeadProfile { id: string; company_id: string; profile_summary: string; pain_points: string[]; ai_use_case: string | null; ai_readiness: "low" | "medium" | "high"; outreach_angle: string | null; llm_model: string; llm_confidence: number | null; is_fallback: boolean; created_at: string; } export interface LeadScore { id: string; company_id: string; contact_id: string | null; total_score: number; tier: LeadTier; company_fit: number | null; ai_readiness: number | null; decision_maker: number | null; growth_signal: number | null; engagement_potential: number | null; score_reasoning: string | null; scored_at: string; } export interface HumanReviewItem { id: string; type: "outreach_approval" | "score_anomaly" | "escalation"; company_id: string | null; contact_id: string | null; payload: Record; status: ReviewStatus; reviewer_notes: string | null; resolved_at: string | null; created_at: string; } // ─── Insert types (no id/timestamps) ───────────────────────── export type InsertCompany = Omit; export type InsertContact = Omit; export type InsertEvidence = Omit; export type InsertLeadProfile = Omit; export type InsertLeadScore = Omit; // ─── Trigger.dev event payloads ──────────────────────────────── export interface CompanyDiscoveredPayload { company_id: string; domain: string; name: string; region: string; source: "auto" | "manual"; } export interface LeadScoredPayload { lead_score_id: string; company_id: string; contact_id: string | null; total_score: number; tier: LeadTier; } export interface OutreachQueuedPayload { company_id: string; contact_id: string; score: number; tier: LeadTier; }