/**
 * Site-wide constants, catalog types, and the initial category taxonomy.
 *
 * Phase 1 note: this file defines the *shape* of the catalog so UI
 * components and routes can be built against it. The real database-backed
 * models arrive in Phase 2. No game records live here.
 */

export const SITE = {
  name: "PixelArcade",
  tagline: "Find and play great browser games.",
  description:
    "PixelArcade is a curated mini-games hub. Discover browser games by category, search the catalog, and play through official, authorized sources.",
  url: process.env.NEXT_PUBLIC_SITE_URL ?? "http://localhost:3000",
} as const;

export interface Category {
  slug: string;
  name: string;
  blurb: string;
}

/** Initial Version 1 taxonomy. Extensible — add entries, no code changes needed. */
export const CATEGORIES: readonly Category[] = [
  { slug: "arcade", name: "Arcade", blurb: "Fast, classic pick-up-and-play action." },
  { slug: "puzzle", name: "Puzzle", blurb: "Brain-teasers, logic and clever mechanics." },
  { slug: "racing", name: "Racing", blurb: "Speed, drifts and photo finishes." },
  { slug: "sports", name: "Sports", blurb: "Kick, shoot, swing and score." },
  { slug: "action", name: "Action", blurb: "Reflexes, combat and high energy." },
  { slug: "strategy", name: "Strategy", blurb: "Plan ahead and outsmart the odds." },
  { slug: "brain", name: "Brain", blurb: "Memory, focus and mental workouts." },
  { slug: "adventure", name: "Adventure", blurb: "Explore worlds and follow the story." },
  { slug: "casual", name: "Casual", blurb: "Relaxed games for short breaks." },
  { slug: "multiplayer", name: "Multiplayer", blurb: "Play with or against friends." },
] as const;

export function categoryBySlug(slug: string): Category | undefined {
  return CATEGORIES.find((c) => c.slug === slug.toLowerCase());
}

export type GameStatus = "draft" | "published" | "disabled";

/**
 * Forward-compatible game shape (mirrors the Phase 2 database model).
 * UI components consume this type; Phase 2 will source it from the DB.
 */
export interface GameSummary {
  id: string;
  slug: string;
  title: string;
  description: string;
  categorySlug: string;
  thumbnail?: string | null;
  developer?: string | null;
  publisher?: string | null;
  status: GameStatus;
  featured: boolean;
  trending: boolean;
}

export const NAV_LINKS = [
  { href: "/", label: "Home" },
  { href: "/games", label: "All Games" },
  { href: "/categories", label: "Categories" },
  { href: "/favorites", label: "Favorites" },
  { href: "/recently-played", label: "Recently Played" },
] as const;

/** Local-storage keys for Phase 4 (favorites / recently played). */
export const STORAGE_KEYS = {
  favorites: "pixelarcade:favorites",
  recentlyPlayed: "pixelarcade:recently-played",
} as const;

export const MAX_RECENTLY_PLAYED = 20;
