import { createFileRoute } from "@tanstack/react-router";
import { Header } from "@/components/site/Header";
import { Footer } from "@/components/site/Footer";
import { SignInModal, CartDrawer, CheckoutFlow } from "@/components/site/Modals";
import { useState } from "react";

export const Route = createFileRoute("/returns")({
  head: () => ({
    meta: [{ title: "Returns & Refunds — SulejaMarket" }],
  }),
  component: ReturnsPage,
});

function ReturnsPage() {
  const [signInOpen, setSignInOpen] = useState(false);
  const [cartOpen, setCartOpen] = useState(false);
  const [checkoutOpen, setCheckoutOpen] = useState(false);

  return (
    <div className="min-h-screen bg-neutral-50 flex flex-col">
      <SignInModal open={signInOpen} onOpenChange={setSignInOpen} />
      <CartDrawer open={cartOpen} onOpenChange={setCartOpen} onCheckout={() => { setCartOpen(false); setCheckoutOpen(true); }} />
      <CheckoutFlow open={checkoutOpen} onOpenChange={setCheckoutOpen} />
      <Header onOpenCart={() => setCartOpen(true)} onOpenSignIn={() => setSignInOpen(true)} />
      
      <main className="flex-1 max-w-[800px] w-full mx-auto px-4 py-12">
        <h1 className="text-3xl font-bold mb-6 text-neutral-900">Returns & Refunds</h1>
        <div className="bg-white p-8 rounded-lg border prose max-w-none text-neutral-600">
          <p className="mb-4">We want you to be completely satisfied with your purchase on SulejaMarket.</p>
          <h2 className="text-xl font-semibold mt-6 mb-2 text-neutral-900">7-Day Return Policy</h2>
          <p className="mb-4">If you are not entirely satisfied, you can return items within 7 days of delivery for a full refund or exchange. Items must be in their original condition and packaging.</p>
          <h2 className="text-xl font-semibold mt-6 mb-2 text-neutral-900">How to Return an Item</h2>
          <ol className="list-decimal pl-5 space-y-2 mb-4">
            <li>Log in to your account and go to your Order History.</li>
            <li>Select the order and item you wish to return.</li>
            <li>Choose a return reason and submit the request.</li>
            <li>Pack the item securely and drop it off at the nearest partner location.</li>
          </ol>
          <p className="mt-6 text-sm">For further assistance, please contact our support team at <a href="mailto:support@sulejamarket.ng" className="text-orange-600 hover:underline">support@sulejamarket.ng</a>.</p>
        </div>
      </main>
      
      <Footer />
    </div>
  );
}
