import type { Metadata } from "next";
import { PageHero } from "@/components/site/page-hero";
import { getSettings } from "@/lib/queries";

export const metadata: Metadata = {
  title: "Terms & Conditions",
  description: "Terms and conditions for using the services and website of AL-HASAN ENGINEERING SERVICE (AHE Services).",
  alternates: { canonical: "/terms" },
};

export default async function TermsPage() {
  const settings = await getSettings();
  const company = settings?.companyName ?? "AL-HASAN ENGINEERING SERVICE";
  const email = settings?.email ?? "alhasanengineeringservice@gmail.com";

  return (
    <>
      <PageHero eyebrow="Legal" title="Terms & Conditions" breadcrumbs={[{ label: "Terms & Conditions" }]} />
      <section className="py-16 lg:py-24">
        <div className="container-mx max-w-3xl prose prose-lg">
          <p className="text-muted-foreground">Last updated: {new Date().toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })}</p>

          <h2 className="text-foreground">1. Acceptance of Terms</h2>
          <p className="text-muted-foreground">By accessing or using the services of {company} ("AHE Services", "we", "us"), you agree to be bound by these Terms & Conditions. If you do not agree, please do not use our services.</p>

          <h2 className="text-foreground">2. Services</h2>
          <p className="text-muted-foreground">We provide HVAC installation, repair, maintenance, manufacturing and related services. Specific service deliverables, timelines and pricing are defined in individual quotations, contracts or AMC agreements.</p>

          <h2 className="text-foreground">3. Quotations & Pricing</h2>
          <p className="text-muted-foreground">All quotations are valid for 30 days unless otherwise stated. Prices are subject to change based on equipment availability, currency fluctuations and scope changes. A written quotation signed by both parties constitutes a binding agreement.</p>

          <h2 className="text-foreground">4. Payment Terms</h2>
          <ul className="text-muted-foreground">
            <li>For installations: milestone-based payments as per quotation</li>
            <li>For AMC contracts: monthly, quarterly or annual billing</li>
            <li>For repairs: payment due upon completion unless credit terms are agreed</li>
            <li>Late payments may incur additional charges</li>
          </ul>

          <h2 className="text-foreground">5. Warranties</h2>
          <p className="text-muted-foreground">We provide a written warranty on workmanship for a period specified in your contract. Equipment warranties are subject to manufacturer terms. Warranties do not cover damage from misuse, neglect, unauthorized modifications or force majeure events.</p>

          <h2 className="text-foreground">6. Cancellations</h2>
          <p className="text-muted-foreground">Cancellations must be made in writing. Work completed up to the cancellation date is billable. Deposits may be non-refundable for custom-manufactured equipment.</p>

          <h2 className="text-foreground">7. Limitation of Liability</h2>
          <p className="text-muted-foreground">Our liability is limited to the value of services rendered. We are not liable for indirect, incidental or consequential damages arising from the use of our services, except where prohibited by law.</p>

          <h2 className="text-foreground">8. Force Majeure</h2>
          <p className="text-muted-foreground">We are not liable for delays or failures caused by events beyond our reasonable control, including natural disasters, strikes, supply shortages or government actions.</p>

          <h2 className="text-foreground">9. Governing Law</h2>
          <p className="text-muted-foreground">These terms are governed by the laws of Pakistan. Any disputes shall be resolved in the courts of Karachi, Sindh.</p>

          <h2 className="text-foreground">10. Contact</h2>
          <p className="text-muted-foreground">For questions about these terms, contact us at <a href={`mailto:${email}`} className="text-[var(--brand-royal)]">{email}</a> or {settings?.phone ?? "0301-2435144"}.</p>
        </div>
      </section>
    </>
  );
}
