declare namespace API {
  type AgentNode = {
    appAgentId: string
    creationTime: string
    creatorUserId: string
    data: NodeData
    height?: number
    id: string
    isDeleted?: boolean
    position: { x: number; y: number }
    selected?: boolean
    type: 'custom' | 'start' | 'end' | 'condition' | 'task' | 'http-request'
    updateTime?: string
    width?: number
    zIndex?: number
  }

  type HttpHeader = {
    name: string
    value: string
  }

  type NodeData = {
    outputs: {
      name: string
      describe: string
      type: 'string' | 'number' | 'boolean' | 'object' | 'array'
    }[]
    output_can_alter?: boolean
    variables?: string[]
    method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options'
    ssl_verify?: boolean
    isInIteration?: boolean
    default_value?: string[]
    body?: RequestBody
    params?: string[]
    title: string
    type: 'http-request' | 'condition' | 'task'
    error_strategy?: 'none' | 'retry' | 'abort' | 'continue'
    retry_config?: { max_retries: number; retry_enabled: boolean; retry_interval: number }
    url: string
    authorization?: {
      type: 'none' | 'bearer' | 'basic' | 'api-key'
      config: { api_key?: string; header?: string; type?: string }
    }
    timeout_config?: {
      max_write_timeout: number
      max_read_timeout: number
      max_connect_timeout: number
    }
    heads?: HttpHeader[]
    selected?: boolean
    desc?: string
    isInLoop?: boolean
  }

  type postAgentGetAgentListParams = {
    pageIndex: number
  }

  type RequestBody = {
    data: RequestDataItem[]
    type: 'json' | 'form-data' | 'x-www-form-urlencoded' | 'raw' | 'binary'
  }

  type RequestDataItem = {
    type: 'text' | 'file' | 'json'
    value: string
    key?: string
  }
}
