import type React from "react";
import SummaryGeneratorTool from "@/components/common/SummaryGeneratorTool";
import AiHumanizerTool from "@/components/common/AiHumanizerTool";
import AiEssayWriterTool from "@/components/common/AiEssayWriterTool";
import EssayTyperTool from "@/components/common/EssayTyperTool";
import PlagiarismCheckerTool from "@/components/common/PlagiarismCheckerTool";
import GrammarCheckerTool from "@/components/common/GrammarCheckerTool";
import ParaphrasingTool from "@/components/common/ParaphrasingTool";

/**
 * Every free-tool page's CMS body carries a single literal placeholder
 * token (`templates/GAH/html/com_content/article/<tool>.php`'s own
 * `str_replace('<token>', $form_html, $message1)`) in place of the live
 * site's interactive form — swapped below for a real component, keyed by
 * the article's own alias, the same way `summary-generator` was wired up
 * first. Tools with no real implementation yet get a plain stub (see each
 * component's own header) rather than being left as literal visible text.
 */
export const TOOL_PAGES: Record<string, { token: string; Component: React.ComponentType }> = {
  "summary-generator": { token: "Summary_form", Component: SummaryGeneratorTool },
  "ai-humanizer": { token: "ai_humanizer_form", Component: AiHumanizerTool },
  "ai-essay-writer": { token: "essay_form", Component: AiEssayWriterTool },
  "essay-typer": { token: "essay_form", Component: EssayTyperTool },
  "plagiarism-checker": { token: "PLAGIARISM_FORM", Component: PlagiarismCheckerTool },
  "grammar-checker": { token: "grammar_form", Component: GrammarCheckerTool },
  "paraphrasing-tool": { token: "Parapharse_form", Component: ParaphrasingTool },
};

// Real icon assets copied from templates/GAH/images/ on the Joomla server —
// this row is brand-wide template chrome, not CMS content, so it's a static
// asset here too (see AGENTS.md "Services-section page chrome").
export const TRUST_BADGES = [
  { icon: "/icons/plagiarism.svg", label: "Plagiarism Report", badge: "FREE" },
  { icon: "/icons/revision.svg", label: "Free Revision" },
  { icon: "/icons/availability.svg", label: "24*7 Availability" },
];

// Real, publicly listed scores for each platform (see AGENTS.md) — not the
// site's own aggregate rating, which is a different, higher figure. Logos are
// the same real assets the live site uses.
export const RATING_PLATFORMS = [
  { name: "Google", icon: "/icons/google.svg", score: 4.7 },
  { name: "Sitejabber", icon: "/icons/sitejabber.png", score: 4.3 },
  { name: "Trustpilot", icon: "/icons/trustpilot.png", score: 4.5 },
];

/**
 * The live site's `service.php` article layout hardcodes a per-alias sidebar
 * heading for these pages (it overrides the CMS `banner-form-title` field,
 * which is why that field is empty on every article checked) — copied
 * verbatim from `templates/GAH/html/com_content/article/service.php` on the
 * Joomla server rather than sourced through the API, since the API has no way
 * to expose PHP-hardcoded template logic.
 */
export const ALIAS_BANNER_TEXT: Record<string, { title: string; subtitle: string }> = {
  "summary-writing-services": { title: "Reliable Summary Writing Help", subtitle: "Take Summary Writing Services from Us" },
  "thesis-help": { title: "Reliable Thesis Writing Service", subtitle: "Hire Writer to Get Thesis Writing Help" },
  "homework-help": { title: "Leading Homework Writing Service", subtitle: "Hire Writer to Get Homework Help" },
  "case-study-help": { title: "Credible Case Study Writing Service", subtitle: "Get Case Study Help Online Today" },
  "coursework-help": { title: "Finest Coursework Help", subtitle: "Take Coursework Writing Service Online" },
  "essay-writing": { title: "Trusted Essay Writing Service", subtitle: "Get the Best Essay Help Now" },
  "dissertation-help": { title: "Premium Dissertation Help", subtitle: "Hire a Dissertation Writing Service Expert" },
  "research-paper-help": { title: "Elite Paper Writing Service", subtitle: "Get the Best Paper Help Now" },
};

/**
 * `/our-services` carries no `page-layout` field, so it isn't flagged a
 * Services page — but its CMS body opens with the literal token
 * `our_service_price_calculate_Form`, which `default.php:632` swaps for the
 * very same `banner_landing_pages` block (badges, rating strip, order
 * form), differing only in a hardcoded H1. The token is the signal, so it
 * drives the layout here too, and is stripped from the body.
 */
export const OUR_SERVICES_TOKEN = "our_service_price_calculate_Form";
export const OUR_SERVICES_TITLE = "Assignment to Dissertation - All Under One Roof";

/**
 * `service.php`'s `Full_Page`/`Country_detail_page_new` branch suppresses
 * the standalone banner echo for exactly these 3 aliases (`if
 * ($this->item->alias != 'powerpoint-presentation-services' &&
 * $this->item->alias != 'resume-writing' && $this->item->alias !=
 * 'poster-making-assignment-help') { echo $dynamic_form; }`) — the live
 * site presumably injects it into the body instead via the
 * `dynamic_form`/`calculatorHtml` tokens for these 3 specific articles.
 * This app's copies of these 3 articles don't contain either token
 * (checked directly against the CMS content), so suppressing the banner
 * here does leave them without one — but that's the literal, faithful
 * behavior of the real branch, not a bug in the port.
 */
export const BANNER_SUPPRESSED_ALIASES = new Set([
  "powerpoint-presentation-services",
  "resume-writing",
  "poster-making-assignment-help",
]);

/**
 * `custom_breadcrumb` is a literal placeholder Services-page bodies
 * contain (`service.php`: `str_replace('custom_breadcrumb',
 * $custom_breadcrumb_section, $result)`) — `$custom_breadcrumb_section`
 * is just Joomla's breadcrumb module output (`$renderer->render($position1,
 * ...)`, i.e. `mod_breadcrumbs`), which this app already renders as its
 * own `<Breadcrumb>` component right above this content. So the token is
 * stripped rather than replaced, the same way `OUR_SERVICES_TOKEN` is.
 */
export const CUSTOM_BREADCRUMB_TOKEN = "custom_breadcrumb";

/**
 * `reviews1` (Full_Page, alias `online-exam-help` only:
 * `$result = str_replace('reviews1', $reviews_data, $result)`) — same
 * situation as `custom_breadcrumb`: `$reviews_data` isn't something this
 * app builds (its markup lives in `ContentHelper.php`, not `service.php`),
 * so the token is stripped rather than left visible as literal text.
 */
export const REVIEWS1_TOKEN = "reviews1";
