export interface SearchResult {
  url: string;
  title: string;
  content: string;
  engine: string;
  parsed_url: [string, string, string, string, string]; // scheme, host, path, query, fragment
  engines: string[];
  positions: number[];
  score: number;
  category: string;
  pretty_url: string;
  img_src?: string;
  thumbnail?: string;
  publishedDate?: string;
}

export interface SearXNGResponse {
  query: string;
  number_of_results: number;
  results: SearchResult[];
  answers: string[];
  corrections: string[];
  infoboxes: any[];
  suggestions: string[];
  unresponsive_engines: string[];
}

export const MOCK_RESPONSE: SearXNGResponse = {
  query: "react meta search engine",
  number_of_results: 42,
  results: [
    {
      url: "https://github.com/searxng/searxng",
      title: "SearXNG — A privacy-respecting, hackable metasearch engine",
      content: "SearXNG is a free internet metasearch engine which aggregates results from more than 70 search services. Users are neither tracked nor profiled.",
      engine: "google",
      parsed_url: ["https", "github.com", "/searxng/searxng", "", ""],
      engines: ["google", "bing", "duckduckgo"],
      positions: [1, 2, 1],
      score: 9.5,
      category: "general",
      pretty_url: "github.com/searxng/searxng",
    },
    {
      url: "https://docs.searxng.org/",
      title: "SearXNG Documentation — Getting Started Guide",
      content: "Learn how to install, configure, and customize SearXNG for your own self-hosted search experience. Comprehensive documentation for administrators and developers.",
      engine: "duckduckgo",
      parsed_url: ["https", "docs.searxng.org", "/", "", ""],
      engines: ["duckduckgo", "bing"],
      positions: [3, 4],
      score: 7.2,
      category: "general",
      pretty_url: "docs.searxng.org",
    },
    {
      url: "https://react.dev/learn",
      title: "Quick Start – React",
      content: "React lets you build user interfaces out of individual pieces called components. Create your own React components like Thumbnail, LikeButton, and Video.",
      engine: "google",
      parsed_url: ["https", "react.dev", "/learn", "", ""],
      engines: ["google", "bing", "duckduckgo"],
      positions: [2, 1, 3],
      score: 8.8,
      category: "it",
      pretty_url: "react.dev/learn",
    },
    {
      url: "https://tailwindcss.com/docs",
      title: "Tailwind CSS — Rapidly build modern websites without ever leaving your HTML",
      content: "A utility-first CSS framework packed with classes that can be composed to build any design, directly in your markup. Fast, flexible, and reliable.",
      engine: "bing",
      parsed_url: ["https", "tailwindcss.com", "/docs", "", ""],
      engines: ["bing", "google"],
      positions: [5, 6],
      score: 6.4,
      category: "it",
      pretty_url: "tailwindcss.com/docs",
    },
    {
      url: "https://www.wired.com/story/meta-search-engines-privacy/",
      title: "Why Meta Search Engines Are the Future of Private Web Search",
      content: "As concerns about data privacy grow, meta search engines offer a compelling alternative to traditional search giants. Here's how they protect your data while delivering results.",
      engine: "google",
      parsed_url: ["https", "www.wired.com", "/story/meta-search-engines-privacy/", "", ""],
      engines: ["google", "duckduckgo"],
      positions: [4, 5],
      score: 5.9,
      category: "news",
      pretty_url: "wired.com/story/meta-search-engines-privacy",
      publishedDate: "2024-01-15",
    },
    {
      url: "https://arstechnica.com/information-technology/2024/self-hosted-search/",
      title: "Self-hosted search: Taking back control of your queries",
      content: "More developers are turning to self-hosted metasearch solutions. We look at the best options available today, from SearXNG to Whoogle and beyond.",
      engine: "duckduckgo",
      parsed_url: ["https", "arstechnica.com", "/information-technology/2024/self-hosted-search/", "", ""],
      engines: ["duckduckgo", "google"],
      positions: [6, 8],
      score: 5.1,
      category: "news",
      pretty_url: "arstechnica.com/information-technology/2024/self-hosted-search",
      publishedDate: "2024-02-20",
    },
    {
      url: "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API",
      title: "Fetch API - Web APIs | MDN",
      content: "The Fetch API provides an interface for fetching resources across the network. It provides a more powerful and flexible feature set than XMLHttpRequest.",
      engine: "google",
      parsed_url: ["https", "developer.mozilla.org", "/en-US/docs/Web/API/Fetch_API", "", ""],
      engines: ["google", "bing"],
      positions: [7, 9],
      score: 4.8,
      category: "it",
      pretty_url: "developer.mozilla.org/en-US/docs/Web/API/Fetch_API",
    },
  ],
  answers: [],
  corrections: [],
  infoboxes: [],
  suggestions: ["searxng setup guide", "private search engine comparison", "react search component"],
  unresponsive_engines: [],
};

export const CATEGORIES = ["general", "it", "images", "news"] as const;
export type Category = typeof CATEGORIES[number];
