/**
 * BPMN.js 和 Camunda 相关的 TypeScript 类型声明
 */

declare module 'bpmn-js/lib/Modeler' {
  import { ModuleDeclaration } from 'didi';

  export interface ModelerOptions {
    container?: HTMLElement | string;
    width?: number | string;
    height?: number | string;
    moddleExtensions?: Record<string, any>;
    modules?: ModuleDeclaration[];
    additionalModules?: ModuleDeclaration[];
    keyboard?: {
      bindTo?: Document | HTMLElement;
    };
    propertiesPanel?: {
      parent?: HTMLElement | string;
    };
  }

  export default class Modeler {
    constructor(options?: ModelerOptions);
    
    importXML(xml: string): Promise<{ warnings: Array<any> }>;
    saveXML(options?: { format?: boolean; preamble?: boolean }): Promise<{ xml: string }>;
    saveSVG(options?: Record<string, any>): Promise<{ svg: string }>;
    
    get<T = any>(serviceName: string): T;
    invoke<T = any>(fn: (...args: any[]) => T): T;
    
    destroy(): void;
    clear(): void;
    
    attachTo(parentNode: HTMLElement): void;
    detach(): void;
    
    on(event: string, callback: (...args: any[]) => void, priority?: number): void;
    off(event: string, callback?: (...args: any[]) => void): void;
  }
}

declare module 'camunda-bpmn-moddle/resources/camunda.json' {
  const camundaModdleDescriptor: any;
  export default camundaModdleDescriptor;
}

declare module 'bpmn-js-properties-panel' {
  export const BpmnPropertiesPanelModule: any;
  export const BpmnPropertiesProviderModule: any;
  export const CamundaPlatformPropertiesProviderModule: any;
}

declare module '@bpmn-io/properties-panel' {
  export const PropertiesPanelModule: any;
}

declare module '@bpmn-io/properties-panel/assets/properties-panel.css' {
  const content: string;
  export default content;
}

