// View-model types for the Technical Audit page sections.
// Each interface is a narrowed, renderable projection of SeoSection fields.

export interface DimensionPoint {
  label: string;
  score: number;
}

export interface HeroViewModel {
  healthScore: number;
  healthDelta: number | null;
  dimensions: DimensionPoint[];
  narrative: string;
  hasCompetitors: boolean;
  topCompetitorDomains: string[];
  brandName: string;
  brandDomain: string;
}

export interface StatSourceBreakdown {
  total: number;
  audit: number;
  siteTag: number;
  signal: number;
  // Pattern-level stats from Site Tag behavioral data (Phase 19A.18).
  // Present only when Site Tag has data and error pattern query succeeded.
  patternCount?: number | null;
  affectedPageCount?: number | null;
  // True when the underlying Site Tag count() query timed out.
  // The total reflects audit + signal counts only; siteTag contribution is 0.
  isUpdating?: boolean;
}

export interface StatsViewModel {
  errors: StatSourceBreakdown;
  warnings: StatSourceBreakdown;
  notices: StatSourceBreakdown;
  quickWins: StatSourceBreakdown;
}

export interface PriorityItemViewModel {
  severity: "critical" | "high";
  dimension: string;
  scoreLift: number | null;
  title: string;
  subline: string;
  recommendedNextSteps: string[];
  affectedPages: string[];
  fixCode: string | null;
  fixAction: string | null;
  category: "seo" | "tech" | "multilingual" | "compliance" | "ecommerce" | "b2b";
}

export interface PriorityViewModel {
  items: PriorityItemViewModel[];
}

export interface MatrixRowViewModel {
  page: string;
  intent: "info" | "commercial" | "transactional";
  traffic: string;
  tech: { count: number; level: "critical" | "issues" | "none" };
  schema: { count: number; level: "critical" | "issues" | "none" };
  eeat: { count: number; level: "critical" | "issues" | "none" };
  snippet: { count: number; level: "critical" | "issues" | "none" };
  voice: number | null;
  aiVis: string | null;
}

export interface MatrixViewModel {
  rows: MatrixRowViewModel[];
}

export interface AnnotationFindingViewModel {
  num: number;
  severity: "critical" | "high" | "moderate";
  title: string;
  desc: string;
}

export interface AnnotationViewModel {
  available: boolean;
  pageTitle: string;
  findings: AnnotationFindingViewModel[];
}

export interface BehavioralItemViewModel {
  url: string;
  count: string;
}

export interface BehavioralCardViewModel {
  title: string;
  stat: number;
  statMeta: string;
  items: BehavioralItemViewModel[];
}

export interface BehavioralViewModel {
  available: boolean;
  cards: BehavioralCardViewModel[];
}

