/// <reference types="next" />
/// <reference types="next/image-types/global" />

declare module 'framer-motion' {
  import type { ComponentType } from 'react';

  // Minimal shim to satisfy strict typing for usage in JSX
  export type MotionComponent = ComponentType<Record<string, unknown>>;

  export const motion: {
    div: MotionComponent;
    span: MotionComponent;
    button: MotionComponent;
    svg: MotionComponent;
    p: MotionComponent;
    [element: string]: MotionComponent;
  };

  export const AnimatePresence: ComponentType<Record<string, unknown>>;

  export function useReducedMotion(): boolean;

  // Shim motion values with a minimal interface exposing .set()
  export interface MotionValue<T = number> {
    get(): T;
    set(v: T): void;
  }

  export function useMotionValue(initial: number): MotionValue<number>;
  export function useSpring(value: MotionValue<number> | number, config?: Record<string, unknown>): MotionValue<number>;
  export function useTransform<TInput, TOutput>(
    value: MotionValue<TInput>,
    transformer: (input: TInput) => TOutput,
  ): MotionValue<TOutput>;
}

declare module '@next/third-party-devtools' {
  import type { ComponentType } from 'react';
  const Devtools: ComponentType<Record<string, unknown>>;
  export default Devtools;
}

declare module 'react/compiler-runtime' {
  export {};
}

declare global {
  namespace NodeJS {
    interface ProcessEnv {
      NODE_ENV?: 'development' | 'production' | 'test';

      // Website (public, exposed to browser)
      NEXT_PUBLIC_GRIDPILOT_MODE?: 'pre-launch' | 'alpha';
      NEXT_PUBLIC_SITE_URL?: string;
      NEXT_PUBLIC_API_BASE_URL?: string;
      NEXT_PUBLIC_SITE_NAME?: string;
      NEXT_PUBLIC_SUPPORT_EMAIL?: string;
      NEXT_PUBLIC_SPONSOR_EMAIL?: string;
      NEXT_PUBLIC_LEGAL_COMPANY_NAME?: string;
      NEXT_PUBLIC_LEGAL_VAT_ID?: string;
      NEXT_PUBLIC_LEGAL_REGISTERED_COUNTRY?: string;
      NEXT_PUBLIC_LEGAL_REGISTERED_ADDRESS?: string;
      NEXT_PUBLIC_DISCORD_URL?: string;
      NEXT_PUBLIC_X_URL?: string;
      NEXT_TELEMETRY_DISABLED?: string;

      // Website (server-only)
      API_BASE_URL?: string;

      // Vercel KV (server-only)
      KV_REST_API_URL?: string;
      KV_REST_API_TOKEN?: string;

      // Build/CI toggles (server-only)
      CI?: string;
      DOCKER?: string;
    }
  }
}

export {};