/* Menu */
declare namespace Menu {
  interface MenuOptions {
    path: string;
    name: string;
    component?: string | (() => Promise<unknown>);
    redirect?: string;
    meta: MetaProps;
    children?: MenuOptions[];
  }
  interface MetaProps {
    icon: string;
    title: string;
    activeMenu?: string;
    isLink?: string;
    isHide: boolean;
    isFull: boolean;
    isAffix: boolean;
    isKeepAlive: boolean;
    /** 仅一个可见子菜单时不在侧栏渲染父级分组，直接展示子项 */
    flattenSingleChild?: boolean;
  }
}

/* FileType */
declare namespace File {
  type ImageMimeType =
    | "image/apng"
    | "image/bmp"
    | "image/gif"
    | "image/jpeg"
    | "image/pjpeg"
    | "image/png"
    | "image/svg+xml"
    | "image/tiff"
    | "image/webp"
    | "image/x-icon";

  type ExcelMimeType = "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
}

/* Vite */
declare type Recordable<T = any> = Record<string, T>;

declare interface ViteEnv {
  VITE_USER_NODE_ENV: "development" | "production" | "test";
  VITE_GLOB_APP_TITLE: string;
  VITE_PORT: number;
  VITE_OPEN: boolean;
  VITE_REPORT: boolean;
  VITE_ROUTER_MODE: "hash" | "history";
  VITE_BUILD_COMPRESS: "gzip" | "brotli" | "gzip,brotli" | "none";
  VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
  VITE_DROP_CONSOLE: boolean;
  VITE_PWA: boolean;
  VITE_DEVTOOLS: boolean;
  VITE_PUBLIC_PATH: string;
  VITE_API_URL: string;
  VITE_API_URL_PLATFORM: string;
  VITE_PROXY: [string, string][];
  VITE_PROXY_AI: [string, string][];
  VITE_CODEINSPECTOR: boolean;
  VITE_API_ENCRYPTION_ENABLED: string;
  VITE_CRYPTO_KEY: string;
  VITE_CRYPTO_IV: string;
  VITE_WS_BASE?: string;
  /** 上传 API 请求根（可选；不配则默认同源 /ai-upload，依赖 Vite/Nginx 反代） */
  VITE_AI_UPLOAD_BASE?: string;
  /** 上传完成后对外访问 URL 前缀 */
  VITE_AI_FILES_PUBLIC_BASE?: string;
  /** 可选；官方相册视频 simple 上传服务根，不配则开发走相对路径 /dev-upload-ailien/...、生产默认 upload.ailien.shop:8443 */
  VITE_DEV_UPLOAD_SIMPLE_BASE?: string;
}

interface ImportMetaEnv extends ViteEnv {
  __: unknown;
}

/* __APP_INFO__ */
declare const __APP_INFO__: {
  pkg: {
    name: string;
    version: string;
    dependencies: Recordable<string>;
    devDependencies: Recordable<string>;
  };
  lastBuildTime: string;
};
