export interface IconConfig {
  rel: string;
  href: string;
}

export interface MetaData {
  baseUrl: string;
  title: string;
  name: string;
  owner: string;
  ogImage: string;
  description: string;
  shareTitle: string;
  shareDescription: string;
  shareImageAlt: string;
  favicon: string;
  icons: IconConfig[];
}

export interface WhitelabelConfig {
  title: string;
  name: string;
  brandColor: string;
  siteTitle: string;
  logoText: string;
  shareTitle: string;
  shareDescription: string;
  ogImage: string;
  shareImageAlt: string;
  favicon: string;
  baseUrl: string;
  siteName: string;
}

export interface ProtectedRoute {
  path: string;
  roles?: string[];
  exclude?: string[];
}

export const metaData: MetaData = {
  baseUrl: "https://codey.horse/",
  title: "CODEY STUFF",
  name: "codey.horse",
  owner: "codey",
  ogImage: "/images/favicon.png",
  description: "CODEY STUFF!",
  shareTitle: "CODEY STUFF",
  shareDescription: "CODEY STUFF!",
  // alt text for the share/OG image (descriptive; not a filename)
  shareImageAlt: "CODEY STUFF logo",
  // default favicon / site icon used when no per-subsite override is provided
  favicon: "/images/favicon.png",
  // additional icons array (optional) for multi-icon support
  icons: [
    { rel: 'icon', href: '/images/favicon.png' },
  ],
};

export const API_URL: string = "https://api.codey.horse";
export const RADIO_API_URL: string = "https://radio-api.codey.horse";

export const socialLinks: Record<string, string> = {
};

export const MAJOR_VERSION: string = "0.8"
export const RELEASE_FLAG: string | null = null;
export const ENVIRONMENT: "Dev" | "Prod" = import.meta.env.DEV ? "Dev" : "Prod";

// Whitelabel overrides
export const WHITELABELS: Record<string, WhitelabelConfig> = {
  'req.boatson.boats': {
    title: 'Request Media',
    name: 'REQ',
    brandColor: '', // inherit
    siteTitle: 'Request Media',
    logoText: 'Request Media',
    // optional meta overrides for whitelabel/subsite
    shareTitle: 'Request Media',
    shareDescription: 'Request Media',
    ogImage: '/images/req.png',
    shareImageAlt: 'Request Media logo',
    favicon: '/images/req.png',
    // optional canonical/base url for this subsite (useful when host-forcing or in prod)
    baseUrl: 'https://req.boatson.boats',
    // human-readable site name for social meta
    siteName: 'Request Media'
  },
};

// Subsite mapping: host -> site path
export const SUBSITES: Record<string, string> = {
  'req.boatson.boats': '/subsites/req',
};

// Protected routes configuration
// Routes listed here require authentication - middleware will redirect to /login if not authenticated
// Can be a string (just auth required) or object with roles array for role-based access
// Use 'exclude' array to exempt specific sub-paths from protection
export const PROTECTED_ROUTES: ProtectedRoute[] = [
  { path: '/discord-logs', roles: ['discord'] },
  { path: '/api/discord', roles: ['discord'], exclude: ['/api/discord/cached-image'] },
  { path: '/TRip', roles: ['trip'] },
  { path: '/TRip/requests', roles: ['trip'] },
  { path: '/lighting', roles: ['lighting'] },
];

// Routes that should skip auth check entirely (public routes)
export const PUBLIC_ROUTES: string[] = [
  '/',
  '/login',
  '/api/',
];