/* eslint-disable @typescript-eslint/no-unused-vars */
import type { IAmfDocument } from '@api-client/core/amf/definitions/Amf.js'
import type {
  DocumentMeta,
  ApiEndPointWithOperationsListItem,
  ApiSecuritySchemeListItem,
  ApiNodeShapeListItem,
} from '../types.js'
import { AmfSerializer } from '@api-client/core/amf/AmfSerializer.js'
import type {
  IApiSummary,
  IApiEndPoint,
  IApiServer,
  IApiOperation,
  IApiDocumentation,
  IApiSecurityScheme,
  IApiSecurityRequirement,
  IApiRequest,
  IApiResponse,
  IApiPayload,
} from '@api-client/core/amf/definitions/Api.js'
import type { ServersQueryOptions } from '@api-client/core/amf/AmfMixin.js'
import type { IShapeUnion } from '@api-client/core/amf/definitions/Shapes.js'

/**
 * An abstract base class for the store implementation that works with API Components.
 */
export class AmfStore {
  /**
   * For future use.
   * Indicates that the store is read only.
   */
  readonly: boolean

  target: EventTarget

  serializer: AmfSerializer

  /**
   * @param target The event target to dispatch the events on.
   */
  constructor(target: EventTarget = window, graph?: IAmfDocument) {
    this.readonly = true
    this.target = target
    let amf = graph
    if (Array.isArray(graph)) {
      ;[amf] = graph
    }
    /**
     * The API serializer
     */
    this.serializer = new AmfSerializer(amf)
  }

  /**
   * @returns The list of domain types for the currently loaded document.
   */
  getDocumentTypes(): string[] {
    throw new Error('Not implemented')
  }

  /**
   * Gathers information about the loaded document.
   * This is mainly used by the `api-documentation` element to decide which documentation to render.
   */
  async documentMeta(): Promise<DocumentMeta> {
    throw new Error('Not implemented')
  }

  /**
   * @returns API summary for the summary view.
   */
  async apiSummary(): Promise<IApiSummary | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * @returns Currently loaded API's protocols
   */
  async apiProtocols(): Promise<string[] | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * @returns Currently loaded API's version
   */
  async apiVersion(): Promise<string | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Reads an endpoint by its id.
   * @param id The domain id of the endpoint.
   */
  async getEndpoint(id: string): Promise<IApiEndPoint | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Reads an endpoint by its path.
   * @param path The path value of the endpoint or channel name.
   */
  async getEndpointByPath(path: string): Promise<IApiEndPoint | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Lists all endpoints with operations included into the result.
   */
  async listEndpointsWithOperations(): Promise<ApiEndPointWithOperationsListItem[]> {
    throw new Error('Not implemented')
  }

  /**
   * Queries for the list of servers for method, if defined, or endpoint, if defined, or root level
   * @param query Server query options
   * @returns The list of servers for given query.
   */
  async queryServers(query?: ServersQueryOptions): Promise<IApiServer[]> {
    throw new Error('Not implemented')
  }

  /**
   * Reads the operation model.
   * @param operationId The domain id of the operation to read.
   * @param endpointId Optional endpoint id. When not set it searches through all endpoints.
   */
  async getOperation(operationId: string, endpointId?: string): Promise<IApiOperation | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Finds an endpoint that has the operation.
   * @param id Method name or the domain id of the operation to find
   */
  async getOperationParent(id: string): Promise<IApiEndPoint | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Lists the documentation definitions for the API.
   */
  async listDocumentations(): Promise<IApiDocumentation[] | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Reads the documentation object from the store.
   * @param id The domain id of the documentation object
   * @returns The read documentation.
   */
  async getDocumentation(id: string): Promise<IApiDocumentation | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Reads the SecurityScheme object from the graph.
   * @param id The domain id of the SecurityScheme
   */
  async getSecurityScheme(id: string): Promise<IApiSecurityScheme | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Reads the SecurityRequirement object from the graph.
   * @param id The domain id of the SecurityRequirement
   */
  async getSecurityRequirement(id: string): Promise<IApiSecurityRequirement | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Lists the security definitions for the API.
   */
  async listSecurity(): Promise<ApiSecuritySchemeListItem[]> {
    throw new Error('Not implemented')
  }

  /**
   * Reads the Request object from the graph.
   * @param id The domain id of the Request
   */
  async getRequest(id: string): Promise<IApiRequest | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Reads the response data from the graph.
   * @param id The domain id of the response.
   */
  async getResponse(id: string): Promise<IApiResponse | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Reads Payload data from the graph
   * @param id The domain id of the payload
   */
  async getPayload(id: string): Promise<IApiPayload | undefined> {
    throw new Error('Not implemented')
  }

  /**
   * Lists the type (schema) definitions for the API.
   */
  async listTypes(): Promise<ApiNodeShapeListItem[]> {
    throw new Error(`Not implemented`)
  }

  /**
   * @param id The domain id of the API type (schema).
   */
  async getType(id: string): Promise<IShapeUnion | undefined> {
    throw new Error('Not implemented')
  }
}
