export type MobileFindingSeverity = "critical" | "high" | "moderate" | "low";

export type MobileDimension =
  | "viewport"
  | "touch_targets"
  | "mobile_schema"
  | "amp"
  | "above_fold_composition";

export interface MobileFinding {
  id: string;
  dimension: MobileDimension;
  severity: MobileFindingSeverity;
  title: string;
  detail: string;
  affectedUrl?: string;
  recommendation: string;
}

export interface PerPageMobileEvaluation {
  pageUrl: string;
  pageLabel: string;
  mobileScreenshotUrl: string | null;
  mobileScore: number;
  findings: MobileFinding[];
  viewport: {
    hasViewportMeta: boolean;
    viewportContent: string | null;
    isOptimal: boolean;
    issues: string[];
  };
  touchTargets: {
    totalInteractiveElements: number;
    tooSmallCount: number;
    tooCloseCount: number;
    passRate: number;
    issues: string[];
  };
  mobileSchema: {
    hasLocalBusinessSchema: boolean;
    hasMobileSpecificSchema: boolean;
    detectedTypes: string[];
    missingRecommended: string[];
  };
  ampStatus: {
    hasAmpVersion: boolean;
    ampUrl: string | null;
    ampValid: boolean | null;
  };
  aboveFoldComposition: {
    hasCta: boolean;
    hasPhoneNumber: boolean;
    hasHours: boolean;
    hasPrice: boolean;
    hasDemo: boolean;
    score: number;
    verticalNotes: string[];
  };
}

export interface MobileFirstAudit {
  hasAudit: boolean;
  windowDate: string;
  pagesEvaluated: number;
  overallMobileScore: number;
  scoreTier: "excellent" | "good" | "needs_improvement" | "poor";
  perPageEvaluations: PerPageMobileEvaluation[];
  topPriorityFindings: MobileFinding[];
  dimensionBreakdown: Record<
    MobileDimension,
    { avgScore: number; findingCount: number; criticalCount: number }
  >;
  verticalSpecificNotes: string[];
  patentRelevance: string;
  costMetrics: {
    pagesAnalyzed: number;
    runtimeSeconds: number;
    estimatedCostUsd: number;
  };
}
