export type SnippetType = 'paragraph' | 'list_ordered' | 'list_unordered' | 'table' | 'definition' | 'how_to' | 'faq' | 'video';

export type SnippetOpportunityStatus = 'not_captured' | 'partially_captured' | 'captured_by_competitor';

export interface SnippetOpportunity {
  id: string;
  query: string;
  snippetType: SnippetType;
  currentCapturingDomain: string | null;
  estimatedMonthlySearchVolume: number | null;
  serpFeatures: string[];
  brandHasMatchingPage: boolean;
  brandMatchingPageUrl: string | null;
  status: SnippetOpportunityStatus;
}

export interface CaptureSpec {
  wordCountTarget: { min: number; max: number };
  paragraphStructure: string;
  headerFormat: string;
  contentSkeleton: string;
  schemaRequirements: Array<{
    schemaType: string;
    requiredProperties: string[];
    optionalProperties: string[];
    rationale: string;
  }>;
  competitorReference: string | null;
  estimatedCaptureProbability: 'high' | 'moderate' | 'low';
  captureRationale: string;
}

export interface CapturedSnippetReformulation {
  opportunityId: string;
  query: string;
  snippetType: SnippetType;
  targetPageUrl: string | null;
  newPageRecommended: boolean;
  newPageSlug: string | null;
  captureSpec: CaptureSpec;
  estimatedMonthlyTrafficGain: number;
  estimatedMonthlyRevenueGain: number;
}

export interface SnippetCaptureStrategy {
  hasStrategy: boolean;
  windowDate: Date;

  totalOpportunitiesAnalyzed: number;
  totalReformulationsGenerated: number;
  totalEstimatedMonthlyTrafficGain: number;
  totalEstimatedMonthlyRevenueGain: number;

  reformulations: CapturedSnippetReformulation[];
  topPriorityReformulations: CapturedSnippetReformulation[];

  snippetTypeBreakdown: Partial<Record<SnippetType, number>>;

  patentRelevance: string;

  costMetrics: {
    opportunitiesIngested: number;
    reformulationsGenerated: number;
    reformulationsFailed: number;
    estimatedCostUsd: number;
    runtimeSeconds: number;
  };
}
