/**
 * Skill 接口定义
 */
export interface ISkill {
  /** Skill 名称 */
  name: string;
  /** Skill 描述 */
  description: string;
  /** Skill 版本 */
  version: string;
  /** 运行时类型 */
  runtime: 'node' | 'python';
  /** 参数定义 */
  parameters: Record<string, any>;
}

/**
 * Skill 执行结果
 */
export interface SkillResult {
  /** 是否成功 */
  success: boolean;
  /** 返回数据 */
  data?: any;
  /** 错误信息 */
  error?: string;
}

/**
 * Skill 元数据
 */
export interface SkillMetadata {
  name: string;
  description: string;
  version: string;
  runtime: 'node' | 'python';
  author?: string;
  tags?: string[];
}

export interface EnvSchemaItem {
  name: string;
  required: boolean;
  description?: string;
  default?: string;
}

export type SkillRuntime = 'node' | 'python' | 'bash' | 'dotnet';
export type SkillClassification = 'prompt' | 'compute-entry' | 'compute-toolkit';

export interface SkillSystemDep {
  name: string;
  check: string;
}

export interface SkillInterfaceField {
  type: string;
  required?: boolean;
  default?: string;
  description?: string;
}

export interface SkillRouteRule {
  match: string[];
  required_refs: string[];
}

export interface SkillConfig {
  runtime?: SkillRuntime;
  entrypoint?: string;
  timeout?: number;
  env?: Array<{ name: string; required: boolean; description?: string; default?: string }>;
  dependencies?: {
    system?: SkillSystemDep[];
    python?: { source?: string; inline?: string[] };
    node?: { packages?: string[] };
    dotnet?: { project?: string };
  };
  setup?: { posix?: string; win32?: string };
  interface?: {
    input?: Record<string, SkillInterfaceField>;
    output?: Record<string, SkillInterfaceField>;
  };
  references?: {
    required?: string[];
    optional?: string[];
    routes?: SkillRouteRule[];
  };
}

export interface SkillDiagnostic {
  level: 'error' | 'warning' | 'info';
  code: string;
  skillName: string;
  message: string;
  path?: string;
  detail?: Record<string, unknown>;
}
