export type PluginManifest = {
  name: string
  key: string
  hook?: string
  singleton?: boolean
  version: string
  description?: string
  author?: string
  logo?: string
  readme?: string
  config?: Record<string, unknown>
}

export type PluginInfo = PluginManifest & {
  config?: Record<string, unknown>
}

export type PluginPayload = {
  content: { type: 'comm' | 'module'; data: string }
  tsContent: { type: 'ts'; data: string }
}

export type PluginCheckResult = {
  type: 0 | 1 | 2 | 3
  message: string
}

export type PluginServices = {
  cache?: {
    get: (key: string) => Promise<unknown>
    set: (key: string, value: unknown) => Promise<unknown>
    del: (key: string) => Promise<unknown>
  }
  pluginService?: {
    getInstance: (key: string) => Promise<unknown>
    invoke: (key: string, method: string, ...params: unknown[]) => Promise<unknown>
  }
}
