import type { Metadata } from 'next'
import InternalPageTemplate from '@/components/InternalPageTemplate'
import BreadcrumbJsonLd from '@/components/BreadcrumbJsonLd'
import Link from 'next/link'
import { getTranslations } from 'next-intl/server'
import { buildAlternates } from '@/lib/seo'

export async function generateMetadata({
  params,
}: {
  params: Promise<{ locale: string }>
}): Promise<Metadata> {
  const { locale } = await params
  const t = await getTranslations('seo')
  const { canonical, languages } = buildAlternates(locale, '/guides/how-to-find-cheapest-hotel-price')
  return {
    title: t('guideHowToFindCheapest'),
    description:
      "A step-by-step guide to finding the cheapest hotel price every time. Covers geo-pricing, platform comparison, timing, and the tools that actually work.",
    openGraph: {
      title: 'How to Find the Cheapest Hotel Price: A Practical Step-by-Step Guide',
      description:
        "Stop overpaying for hotels. Here's a practical guide to finding the actual cheapest rate — covering geo-pricing gaps, platform differences, and booking timing.",
      type: 'article',
    },
    alternates: { canonical, languages },
  }
}

const articleSchema = {
  '@context': 'https://schema.org',
  '@type': 'Article',
  headline: 'How to Find the Cheapest Hotel Price: A Practical Step-by-Step Guide',
  description:
    "A step-by-step guide to finding the cheapest hotel price every time. Covers geo-pricing, platform comparison, timing, and the tools that actually work.",
  author: { '@type': 'Organization', name: 'CahooTravel' },
  publisher: {
    '@type': 'Organization',
    name: 'CahooTravel',
    logo: { '@type': 'ImageObject', url: 'https://www.cahootravel.com/cahootravel-logo.svg' },
  },
  datePublished: '2025-01-20',
  dateModified: '2025-01-20',
  mainEntityOfPage: 'https://www.cahootravel.com/guides/how-to-find-cheapest-hotel-price',
}

export default function HowToFindCheapestHotelPrice() {
  return (
    <InternalPageTemplate>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(articleSchema) }}
      />

      <article className="max-w-3xl">
        {/* Header */}
        <div className="mb-10">
          <div className="flex items-center gap-3 mb-4">
            <span className="text-xs font-medium text-brand-purple bg-brand-purple-light px-2.5 py-1 rounded-full">
              How-To
            </span>
            <span className="text-xs text-gray-400">7 min read</span>
          </div>
          <h1 className="text-4xl font-bold text-gray-900 mb-4 leading-tight">
            How to Find the Cheapest Hotel Price: A Practical Step-by-Step Guide
          </h1>
          <p className="text-gray-500 text-lg leading-relaxed">
            Most travel advice about finding cheap hotels focuses on timing or loyalty programmes.
            Both help at the margins. The bigger opportunity — typically 15–40% savings — is one
            most guides completely miss: comparing the same hotel across different country markets.
            Here is how to actually find the cheapest price every time.
          </p>
        </div>

        {/* Featured image */}
        <div className="mb-10 rounded-2xl overflow-hidden aspect-[16/7]">
          <img
            src="/guides/how-to-find-cheapest-hotel-price.jpg"
            alt="Traveller comparing hotel prices on a laptop and phone"
            className="w-full h-full object-cover"
          />
        </div>

        <div className="prose prose-gray max-w-none text-sm leading-relaxed space-y-8">

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">Step 1: Check for geo-pricing gaps first</h2>
            <p className="text-gray-600">
              Before comparing platforms or obsessing over booking dates, check whether the hotel
              you have in mind has a geo-pricing gap. Geo-pricing is the practice of showing
              different prices to users from different countries for the same room on the same night.
            </p>
            <p className="text-gray-600 mt-3">
              On Booking.com, Airbnb, and Expedia, geo-pricing gaps of 15–30% are typical for
              international destinations. For hotels in Southeast Asia, Japan, and parts of Latin
              America, gaps above 40% are common. This is almost always the single largest saving
              available.
            </p>
            <p className="text-gray-600 mt-3">
              To check for a geo-pricing gap: copy the hotel URL from whichever platform you found
              it on, paste it into CahooTravel, and within seconds you will see the price for that
              exact hotel across 100+ country markets. If there is a cheaper market — and for most
              international hotels there is — you can book directly at that rate.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">Step 2: Compare across platforms</h2>
            <p className="text-gray-600">
              The same property is often listed on multiple platforms at different prices. A hotel
              room that costs €120 on Booking.com might be €108 on Expedia or €115 on the
              hotel&apos;s own website (where loyalty discounts sometimes apply). Platform
              comparison is the second most reliable savings lever.
            </p>
            <p className="text-gray-600 mt-3">
              Key platforms to check for each booking:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li><strong>Booking.com</strong> — widest inventory globally, frequent country-specific promotions</li>
              <li><strong>Expedia</strong> — bundles often cheaper; loyalty rates for frequent users</li>
              <li><strong>Agoda</strong> — often cheapest for Asia-Pacific properties; strong local market pricing in Japan, Thailand, South Korea</li>
              <li><strong>Airbnb</strong> — for apartments and unique stays; service fee varies significantly by country</li>
              <li><strong>Hotels.com</strong> — loyalty rewards accumulate quickly; occasionally best for city centre hotels</li>
              <li><strong>The hotel&apos;s own website</strong> — no OTA commission markup; best booking.com rate guarantee sometimes applies</li>
            </ul>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">Step 3: Consider booking timing</h2>
            <p className="text-gray-600">
              Timing matters less than most travellers think for most destinations, but the patterns
              are worth knowing:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>
                <strong>City business hotels</strong> typically drop in price at weekends and for
                last-minute bookings (Monday–Tuesday of the stay week). The demand is from business
                travellers who book late and cancel frequently.
              </li>
              <li>
                <strong>Resort and leisure hotels</strong> tend to get more expensive as the date
                approaches, especially in peak season. Early booking (3–6 months out) is generally
                better.
              </li>
              <li>
                <strong>Booking on mobile</strong> occasionally shows app-exclusive discounts on
                Booking.com and Agoda. Check both web and app prices for the same property.
              </li>
            </ul>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">Step 4: Use loyalty programmes strategically</h2>
            <p className="text-gray-600">
              If you stay in the same hotel chain more than 3–4 times per year, loyalty membership
              is worth it. Marriott Bonvoy, Hilton Honors, IHG One, and Accor ALL consistently offer
              member rates 5–15% below standard prices, plus occasional upgrade benefits.
            </p>
            <p className="text-gray-600 mt-3">
              The catch: most loyalty rates still apply geo-pricing. The member rate a US user sees
              differs from the member rate a Thai user sees for the same property. Running a
              geo-pricing check on the member rate URL is still worthwhile.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">Step 5: Check cancellation terms before booking</h2>
            <p className="text-gray-600">
              The cheapest rate is often non-refundable. If your plans are firm, this is fine. If
              not, factor the cancellation risk into the price comparison. A free-cancellation rate
              that is €15 more expensive than the cheapest non-refundable option is almost always
              worth it for trips more than 4 weeks out.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">What actually moves the needle most</h2>
            <p className="text-gray-600">
              In practice, the single largest saving available for most international hotel bookings
              is the geo-pricing gap — not timing, loyalty, or platform switching. Here&apos;s a rough
              guide to expected savings from each approach:
            </p>
            <div className="bg-gray-50 rounded-xl border border-gray-100 overflow-hidden mt-4">
              <table className="w-full text-sm">
                <thead>
                  <tr className="bg-gray-100 text-left">
                    <th className="px-4 py-3 font-semibold text-gray-700">Strategy</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">Typical saving</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">Effort</th>
                  </tr>
                </thead>
                <tbody className="divide-y divide-gray-100">
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Geo-pricing comparison</td>
                    <td className="px-4 py-3 font-medium text-green-600">15–40%</td>
                    <td className="px-4 py-3 text-gray-500">Low (30 seconds)</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Platform comparison</td>
                    <td className="px-4 py-3 text-gray-700">5–15%</td>
                    <td className="px-4 py-3 text-gray-500">Medium</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Loyalty member rate</td>
                    <td className="px-4 py-3 text-gray-700">5–12%</td>
                    <td className="px-4 py-3 text-gray-500">Low (if already a member)</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Booking timing</td>
                    <td className="px-4 py-3 text-gray-700">3–10%</td>
                    <td className="px-4 py-3 text-gray-500">High (requires flexibility)</td>
                  </tr>
                </tbody>
              </table>
            </div>
          </section>

          {/* CTA */}
          <div className="rounded-2xl bg-brand-purple text-white p-8 flex flex-col md:flex-row items-center justify-between gap-6 mt-4">
            <div>
              <h3 className="text-lg font-bold mb-1">Start with the biggest saving first</h3>
              <p className="text-purple-200 text-sm">
                Paste any hotel URL and see the geo-pricing gap across 100+ countries in seconds.
                Free to use — no account required.
              </p>
            </div>
            <Link
              href="/"
              className="flex-shrink-0 bg-brand-yellow hover:bg-brand-yellow-dark text-gray-900 font-medium text-sm px-6 py-2.5 rounded-md transition-colors whitespace-nowrap"
            >
              Check your hotel →
            </Link>
          </div>
        </div>
      </article>

      <BreadcrumbJsonLd
        items={[
          { name: 'Guides', path: '/guides' },
          { name: 'How to Find the Cheapest Hotel Price' },
        ]}
      />
    </InternalPageTemplate>
  )
}
