"use client";

import type { ReactNode } from "react";
import { cn } from "@/lib/utils";
import { PageHeader } from "./PageHeader";

/**
 * Header for the transaction form screens.
 *
 * This used to be a second, independent copy of `PageHeader` — same breadcrumb
 * list, same gradient panel, same accent bar, same blurred blob, ~120 duplicated
 * lines that had already drifted apart (h1 vs h2, different back-button hover).
 * It is now a thin adapter so both header styles stay identical by construction.
 *
 * The public prop shape is unchanged, so all 17 form pages keep working as-is.
 */

interface BreadcrumbItem {
  label: string;
  href?: string;
}

export interface FormSectionHeadingProps {
  title: string;
  icon?: ReactNode;
  eyebrow?: string;
  description?: string;
  breadcrumbs?: BreadcrumbItem[];
  showBackButton?: boolean;
  className?: string;
}

export function FormSectionHeading({
  title,
  icon,
  eyebrow,
  description,
  breadcrumbs = [],
  showBackButton = false,
  className,
}: FormSectionHeadingProps) {
  return (
    <PageHeader
      title={title}
      icon={icon}
      eyebrow={eyebrow}
      description={description}
      breadcrumbs={breadcrumbs}
      showBackButton={showBackButton}
      // Sits inside the form panel rather than on the page canvas, so it carries
      // the panel's own padding and no bottom margin.
      className={cn("mb-0 px-5 pt-5 sm:px-6 sm:pt-6", className)}
    />
  );
}
