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/hotel-geo-pricing-explained')
  return {
    title: t('guideGeoPricing'),
    description:
      'Booking platforms like Booking.com and Airbnb show different prices to users from different countries. Here\'s why it happens and how to use it to your advantage.',
    openGraph: {
      title: 'Hotel Geo-Pricing Explained',
      description:
        'The same hotel room costs different amounts depending on where in the world you\'re searching from. Here\'s the full explanation.',
      type: 'article',
    },
    alternates: { canonical, languages },
  }
}

const articleSchema = {
  '@context': 'https://schema.org',
  '@type': 'Article',
  headline:
    'Hotel Geo-Pricing Explained: Why the Same Room Costs More Depending on Where You Search',
  description:
    'Booking platforms like Booking.com and Airbnb show different prices to users from different countries. Here\'s why it happens and how to use it to your advantage.',
  author: { '@type': 'Organization', name: 'CahooTravel' },
  publisher: {
    '@type': 'Organization',
    name: 'CahooTravel',
    logo: { '@type': 'ImageObject', url: 'https://www.cahootravel.com/cahootravel-logo.svg' },
  },
  datePublished: '2025-01-15',
  dateModified: '2025-01-15',
  mainEntityOfPage: 'https://www.cahootravel.com/guides/hotel-geo-pricing-explained',
}

export default function HotelGeoPricingGuide() {
  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">
              Fundamentals
            </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">
            Hotel Geo-Pricing Explained: Why the Same Room Costs More Depending on Where You Search
          </h1>
          <p className="text-gray-500 text-lg leading-relaxed">
            You and a friend book the same hotel room on Booking.com on the same night. You pay €180.
            They pay €130. Same room. Same night. Same platform. The difference? They searched from a
            different country. This is geo-pricing — and it affects millions of travellers every day.
          </p>
        </div>

        {/* Featured image */}
        <div className="mb-10 rounded-2xl overflow-hidden aspect-[16/7]">
          <img
            src="/guides/hotel-geo-pricing.jpg"
            alt="Hotel room with city view representing geo-pricing differences"
            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">What is hotel geo-pricing?</h2>
            <p className="text-gray-600">
              Geo-pricing (also called geographic price discrimination) is the practice of showing
              different prices for the same product or service to users in different countries or
              regions. It is legal, widespread, and deliberately designed to maximise revenue from
              each market.
            </p>
            <p className="text-gray-600 mt-3">
              For hotels, this means a room at a Tokyo Marriott can appear at ¥28,000 to someone
              searching from Japan, ¥33,500 to someone searching from the United States, and ¥31,000
              to someone searching from Germany — all at the same time, for the same room, on the
              same booking platform. Price differences of 10–40% are common. In some markets and
              destination types, gaps of over 50% have been observed.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              Why do booking platforms charge different prices by country?
            </h2>
            <p className="text-gray-600">
              Platforms like Booking.com, Airbnb, and Expedia use sophisticated revenue management
              systems that factor in multiple variables when determining the price a user sees:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>
                <strong>Purchasing power parity.</strong> A platform can charge more to users from
                high-income countries because those users are statistically willing to pay more.
                Someone browsing from Switzerland can be shown a higher price than someone browsing
                from India for the same property.
              </li>
              <li>
                <strong>Local competition.</strong> In markets where local booking sites compete
                aggressively (such as Ctrip/Fliggy in China, or Jalan in Japan), international
                platforms sometimes offer lower prices to remain competitive with regional alternatives.
              </li>
              <li>
                <strong>Currency and payment processing costs.</strong> The cost of processing
                payments varies by country, and some of that cost is factored into the displayed
                price.
              </li>
              <li>
                <strong>Market-specific promotions.</strong> Platforms regularly run promotions
                targeted at specific countries — for example, discounts visible only to users in
                Germany or South Korea — which create price differences invisible to travellers in
                other markets.
              </li>
              <li>
                <strong>Demand and booking patterns.</strong> If users in a particular country
                historically book at higher rates or cancel less often, algorithms may price up for
                that segment.
              </li>
            </ul>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              How do platforms know where you are searching from?
            </h2>
            <p className="text-gray-600">
              Booking platforms use several signals simultaneously to determine your location:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>
                <strong>IP address.</strong> The most reliable primary signal. Your IP address
                reveals your approximate location with high accuracy.
              </li>
              <li>
                <strong>Device locale and browser language settings.</strong> If your device is set
                to Japanese and your browser is sending <code>Accept-Language: ja-JP</code>,
                platforms interpret this as you being a Japanese user.
              </li>
              <li>
                <strong>Payment method.</strong> A UK Visa card or a Brazilian Boleto payment
                strongly signals your country of residence.
              </li>
              <li>
                <strong>Account history.</strong> If you have a Booking.com account registered in
                France, that account history is a persistent signal regardless of where you currently
                are.
              </li>
            </ul>
            <p className="text-gray-600 mt-3">
              Platforms combine these signals. A user with a German IP, a German browser language,
              and a German credit card will consistently see German-market prices.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              A real-world example: Bangkok hotel, four countries
            </h2>
            <p className="text-gray-600">
              To illustrate how large geo-pricing gaps can be, here is a representative example of
              how a popular mid-range Bangkok hotel might appear on Booking.com to users from
              different countries for a standard double room on the same night:
            </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">Country of search</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">Price shown</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">vs. cheapest</th>
                  </tr>
                </thead>
                <tbody className="divide-y divide-gray-100">
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Thailand (local)</td>
                    <td className="px-4 py-3 font-medium text-green-600">€62</td>
                    <td className="px-4 py-3 text-green-600">cheapest</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">India</td>
                    <td className="px-4 py-3 text-gray-700">€68</td>
                    <td className="px-4 py-3 text-gray-500">+10%</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Germany</td>
                    <td className="px-4 py-3 text-gray-700">€79</td>
                    <td className="px-4 py-3 text-gray-500">+27%</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">United States</td>
                    <td className="px-4 py-3 text-gray-700">€88</td>
                    <td className="px-4 py-3 text-red-500">+42%</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <p className="text-gray-500 text-xs mt-2">
              Illustrative example. Actual price gaps vary by hotel, platform, and time of booking.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              Why VPNs are not a reliable solution
            </h2>
            <p className="text-gray-600">
              The obvious workaround — use a VPN to make it look like you are browsing from a
              cheaper country — is far less effective than most travel hacking articles suggest:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>
                Major booking platforms actively detect and block commercial VPN IP ranges. If your
                VPN IP is flagged as a datacenter address (which most commercial VPNs use), you will
                either see an error, a captcha wall, or the platform will fall back to charging you
                the default price.
              </li>
              <li>
                Even if a VPN bypasses the IP check, your payment method still signals your real
                country. Booking with a UK card from a Thai IP creates a mismatch that some platforms
                use as a fraud signal, potentially blocking your booking.
              </li>
              <li>
                VPN connections add latency, often cause session drops mid-booking, and require
                technical setup that most travellers find impractical.
              </li>
            </ul>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              How to actually find the cheapest price for your hotel
            </h2>
            <p className="text-gray-600">
              The most reliable method is to compare how a specific hotel URL is priced across
              multiple country contexts simultaneously — exactly what CahooTravel does.
            </p>
            <p className="text-gray-600 mt-3">
              Rather than trying to disguise your location (which platforms detect), CahooTravel
              fetches the hotel page as it would appear to users in 100+ countries and shows you the
              full price comparison. You see which country gets the cheapest price, by how much, and
              you can book directly on the platform at that rate.
            </p>
            <p className="text-gray-600 mt-3">
              This approach works because:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>It uses real browser sessions from actual country-based infrastructure, not VPN datacenter IPs</li>
              <li>It checks multiple platforms (Booking.com, Airbnb, Expedia, Agoda and more) in a single search</li>
              <li>It does not require you to change your payment method or create foreign accounts</li>
            </ul>
          </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">See geo-pricing gaps on your next hotel</h3>
              <p className="text-purple-200 text-sm">
                Paste any Booking.com, Airbnb, or Expedia URL and compare prices across 100+ countries for free.
              </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"
            >
              Find the cheapest price →
            </Link>
          </div>
        </div>
      </article>

      <BreadcrumbJsonLd
        items={[
          { name: 'Guides', path: '/guides' },
          { name: 'Hotel Geo-Pricing Explained' },
        ]}
      />
    </InternalPageTemplate>
  )
}
