"use client";

import { isValidLang, rateLimit } from "@mintel/next-utils";

export default function Home() {
  const testLang = "en";
  const isLangValid = isValidLang(testLang);

  const handleTestRateLimit = async () => {
    try {
      await rateLimit("test-user");
      console.log("Rate limit check passed");
    } catch (e) {
      console.error(e);
    }
  };

  return (
    <main className="flex min-h-screen flex-col items-center justify-between p-24">
      <div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
        <h1 className="text-4xl font-bold">Sample Website</h1>
        <p className="mt-4">
          Testing @mintel/next-utils:
          <br />
          Is {'"'}en{'"'} valid? {isLangValid ? "Yes" : "No"}
        </p>
        <button
          onClick={handleTestRateLimit}
          className="mt-4 px-4 py-2 bg-blue-500 text-white rounded"
        >
          Test Rate Limit
        </button>
      </div>
    </main>
  );
}
