"use client";

import { RefreshCcw, Plane } from "lucide-react";
import { Button } from "@/components/ui/button";
import Link from "next/link";

interface HeaderProps {
  title?: string;
  subtitle?: string;
  currentTime?: string;
}

export function Header({ title, subtitle, currentTime }: HeaderProps) {
  return (
    <div className="flex flex-col gap-4">
      <div className="flex items-center justify-between">
        <div className="flex items-center gap-3">
          <Plane className="h-8 w-8 text-blue-600 dark:text-blue-400" />
          <h1 className="text-3xl font-bold tracking-tight">
            {title || "CZQM Ops Support Tool"}
          </h1>
        </div>
        <div className="flex items-center gap-4">
          {currentTime && (
            <p className="text-sm text-gray-600 dark:text-gray-400">
              Last updated: {currentTime}
            </p>
          )}
          <div className="flex gap-2">
            <Button asChild variant="outline">
              <Link href="/">METAR</Link>
            </Button>
            <Button asChild variant="outline">
              <Link href="/controllers">Controllers</Link>
            </Button>
          </div>
          {currentTime && (
            <Button
              onClick={() => window.location.reload()}
              variant="outline"
              className="gap-2"
            >
              <RefreshCcw className="h-4 w-4" />
              Refresh
            </Button>
          )}
        </div>
      </div>
      {subtitle && (
        <p className="text-muted-foreground">{subtitle}</p>
      )}
    </div>
  );
}