/**
 * Platform Abstraction Layer
 * Supports: Roblox, UEFN, Spatial, Core
 */

export type PlatformId = 'roblox' | 'uefn' | 'spatial' | 'core';

export interface Platform {
  id: PlatformId;
  name: string;
  displayName: string;
  language: string;
  fileExtension: string;
  description: string;
  color: string;
  icon: string;
  apiDocs: string;
  status: 'active' | 'beta' | 'coming-soon';
}

export const platforms: Record<PlatformId, Platform> = {
  roblox: {
    id: 'roblox',
    name: 'Roblox',
    displayName: 'Roblox Studio',
    language: 'Lua 5.1',
    fileExtension: '.lua',
    description: 'Build immersive 3D experiences on Roblox',
    color: '#00A2FF',
    icon: '🎮',
    apiDocs: 'https://create.roblox.com/docs',
    status: 'active',
  },
  uefn: {
    id: 'uefn',
    name: 'UEFN',
    displayName: 'Unreal Editor for Fortnite',
    language: 'Verse',
    fileExtension: '.verse',
    description: 'Create Fortnite experiences with Verse',
    color: '#0E86D4',
    icon: '⚡',
    apiDocs: 'https://dev.epicgames.com/documentation/en-us/uefn',
    status: 'beta',
  },
  spatial: {
    id: 'spatial',
    name: 'Spatial',
    displayName: 'Spatial Creator Toolkit',
    language: 'TypeScript',
    fileExtension: '.ts',
    description: 'Build VR/AR experiences for Spatial',
    color: '#FF6B6B',
    icon: '🌐',
    apiDocs: 'https://toolkit.spatial.io/docs',
    status: 'beta',
  },
  core: {
    id: 'core',
    name: 'Core',
    displayName: 'Core Games',
    language: 'Lua 5.3',
    fileExtension: '.lua',
    description: 'Develop multiplayer games on Core',
    color: '#FF4655',
    icon: '🎯',
    apiDocs: 'https://docs.coregames.com',
    status: 'coming-soon',
  },
};

export const activePlatforms = Object.values(platforms).filter(
  (p) => p.status === 'active' || p.status === 'beta'
);

export function getPlatform(id: PlatformId): Platform {
  return platforms[id];
}

export function isPlatformActive(id: PlatformId): boolean {
  return platforms[id].status === 'active';
}

export function getLanguageForPlatform(id: PlatformId): string {
  return platforms[id].language;
}

export function getFileExtensionForPlatform(id: PlatformId): string {
  return platforms[id].fileExtension;
}
