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/geo-pricing-hotels')
  return {
    title: t('guideGeoPricingHotels'),
    description:
      "Hotel geo-pricing means paying more for your room than someone searching from a different country. Here's how it works, how large the gaps are, and how to find the cheapest rate.",
    openGraph: {
      title: 'Hotel Geo-Pricing: Why You Pay More Depending on Where You Search',
      description:
        "The same hotel room can cost 10–40% more based solely on which country your search originates from. Here's the complete guide to geo-pricing.",
      type: 'article',
    },
    alternates: { canonical, languages },
  }
}

const articleSchema = {
  '@context': 'https://schema.org',
  '@type': 'Article',
  headline: 'Hotel Geo-Pricing: Why You Pay More Depending on Where You Search From',
  description:
    "Hotel geo-pricing means paying more for your room than someone searching from a different country. Here's how it works, how large the gaps are, and how to find the cheapest rate.",
  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/geo-pricing-hotels',
}

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

      <article className="max-w-3xl">
        <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">8 min read</span>
          </div>
          <h1 className="text-4xl font-bold text-gray-900 mb-4 leading-tight">
            Hotel Geo-Pricing: Why You Pay More Depending on Where You Search From
          </h1>
          <p className="text-gray-500 text-lg leading-relaxed">
            Geo-pricing is the practice of showing different hotel prices to users based on their
            geographic location. It affects every major booking platform and every major hotel chain.
            If you have ever booked a hotel abroad without checking whether a different country market
            offered a lower price, there is a good chance you paid more than you needed to.
          </p>
        </div>

        <div className="mb-10 rounded-2xl overflow-hidden aspect-[16/7]">
          <img
            src="/guides/geo-pricing-hotels.jpg"
            alt="Globe with hotel icons representing geo-pricing across countries"
            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 use of a user&apos;s
              location as a pricing input. For hotel bookings, this means the price displayed on
              Booking.com, Expedia, or Airbnb varies based on which country the search originates
              from — not just based on currency.
            </p>
            <p className="text-gray-600 mt-3">
              To be clear: this is not about exchange rates. Platforms show different base prices,
              in the same currency, to users in different countries. A British traveller and a Thai
              traveller both viewing the same London hotel in euros may see prices that differ by
              20% or more — with the British traveller seeing the higher price.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">How geo-pricing works technically</h2>
            <p className="text-gray-600">
              Booking platforms build location detection into the core of their pricing engines.
              Every search request carries signals that identify the user&apos;s location:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>
                <strong>IP geolocation</strong> — identifies country and often city with high
                accuracy. This is the primary signal used by all major platforms.
              </li>
              <li>
                <strong>HTTP Accept-Language header</strong> — browser language settings sent with
                every request. A browser set to <code>ja-JP</code> signals a Japanese user.
              </li>
              <li>
                <strong>Account registration history</strong> — platforms store your registration
                country as a persistent profile attribute.
              </li>
              <li>
                <strong>Payment card issuing country</strong> — visible at checkout; used as a
                verification and segmentation signal.
              </li>
            </ul>
            <p className="text-gray-600 mt-3">
              Once the platform has determined your location, the pricing engine looks up the
              market-specific rate for the requested hotel. This rate may differ from another market
              for any of several reasons.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              Why platforms charge different amounts by country
            </h2>
            <p className="text-gray-600">
              The revenue logic is straightforward: charge each market what it can bear.
            </p>
            <p className="text-gray-600 mt-3">
              Users from Switzerland have higher average income than users from Vietnam. A platform
              that charges both the same price is leaving revenue on the table from Swiss users
              while potentially pricing out Vietnamese users. By segmenting on geography, the
              platform captures more revenue per booking globally while maintaining volume in
              price-sensitive markets.
            </p>
            <p className="text-gray-600 mt-3">
              Beyond purchasing power, geo-pricing gaps are also created by:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>Country-specific promotional campaigns targeting certain markets</li>
              <li>Local competitor pricing forcing lower rates in competitive markets</li>
              <li>Different tax treatment and payment processing costs by country</li>
              <li>Historical demand and cancellation patterns by user segment</li>
            </ul>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              Which destinations have the biggest geo-pricing gaps?
            </h2>
            <p className="text-gray-600">
              Geo-pricing gaps are largest where the destination attracts a mix of wealthy
              international visitors and value-conscious local or regional travellers. Southeast
              Asia and East Asia consistently show the largest gaps.
            </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">Region</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">Typical gap</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">Notes</th>
                  </tr>
                </thead>
                <tbody className="divide-y divide-gray-100">
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Southeast Asia</td>
                    <td className="px-4 py-3 font-medium text-green-600">20–45%</td>
                    <td className="px-4 py-3 text-gray-500">Thailand, Vietnam, Indonesia largest</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">East Asia</td>
                    <td className="px-4 py-3 text-gray-700">15–35%</td>
                    <td className="px-4 py-3 text-gray-500">Japan especially pronounced</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Latin America</td>
                    <td className="px-4 py-3 text-gray-700">10–30%</td>
                    <td className="px-4 py-3 text-gray-500">Mexico, Colombia strongest</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Southern Europe</td>
                    <td className="px-4 py-3 text-gray-700">8–20%</td>
                    <td className="px-4 py-3 text-gray-500">Portugal, Spain, Greece</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Western Europe / USA</td>
                    <td className="px-4 py-3 text-gray-700">5–15%</td>
                    <td className="px-4 py-3 text-gray-500">Smaller gaps, still worth checking</td>
                  </tr>
                </tbody>
              </table>
            </div>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              Is geo-pricing legal?
            </h2>
            <p className="text-gray-600">
              Yes. Geographic price discrimination is legal in virtually all jurisdictions and is
              explicitly permitted in the terms of service of all major booking platforms. It is
              the same legal framework that allows airlines to charge different fares by departure
              country or software companies to charge different SaaS prices by region.
            </p>
            <p className="text-gray-600 mt-3">
              Consumers have no legal right to the lowest globally available price. But there is
              also nothing preventing travellers from using tools that reveal the full range of
              prices across markets and choosing to book at the cheapest available rate.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              How to find the cheapest geo-priced rate
            </h2>
            <p className="text-gray-600">
              The most effective method is to compare the hotel URL directly across multiple country
              markets simultaneously. CahooTravel does this automatically: paste any hotel link and
              within seconds you see how that exact room is priced across 100+ countries, ranked
              from cheapest to most expensive.
            </p>
            <p className="text-gray-600 mt-3">
              The result: you can book directly on the platform at the cheapest available rate
              without using a VPN, changing your payment method, or creating foreign accounts.
            </p>
          </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 the geo-pricing gap on your hotel</h3>
              <p className="text-purple-200 text-sm">
                Paste any Booking.com, Airbnb, or Expedia URL and compare prices across 100+
                countries in seconds. Free to use.
              </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' },
        ]}
      />
    </InternalPageTemplate>
  )
}
