/**
 * Copyright IBM Corp. 2024, 2025
 */
import { OpenAPIV2 } from "openapi-types";
import { FileAccessType, OpenApiDocumentObject, OpenApiTagObject, OpenAPIV2Components, OpenAPIV2ComponentsObject, OpenAPIV2HostPath } from "./api-spec-handler.interface.js";

export interface IOpenAPIV2_Handler {
    setInfo(file: FileAccessType, info: OpenAPIV2.InfoObject): Promise<OpenAPIV2.InfoObject>;

    addPath(file: FileAccessType, key: string, newPath: OpenAPIV2.PathItemObject): Promise<OpenAPIV2.Document>;
    updatePath(file: FileAccessType, prevKey: string, newKey: string, newPath: OpenAPIV2.PathItemObject): Promise<OpenAPIV2.Document>;
    deletePath(file: FileAccessType, path: string): Promise<OpenAPIV2.Document>;

    addTag(file: FileAccessType, tag: OpenApiTagObject): Promise<OpenAPIV2.TagObject[]>;
    updateTag(file: FileAccessType, prevKey: string, tag: OpenApiTagObject): Promise<OpenAPIV2.TagObject[]>;
    deleteTag(file: FileAccessType, tag: string): Promise<OpenAPIV2.TagObject[]>;


    addSecurityRequirement(file: FileAccessType, securityRequirementObj: OpenAPIV2.SecurityRequirementObject[]): Promise<OpenAPIV2.SecurityRequirementObject[]>;
    updateSecurityRequirement(file: FileAccessType, prevsecurityRequirementName: string, securityRequirementObj: OpenAPIV2.SecurityRequirementObject): Promise<OpenAPIV2.SecurityRequirementObject[]>;
    deleteSecurityRequirement(file: FileAccessType, securityRequirementName: string): Promise<OpenAPIV2.SecurityRequirementObject[]>;


    addOrUpdateDocument(file: FileAccessType, document: OpenApiDocumentObject): Promise<OpenAPIV2.ExternalDocumentationObject>;
    deleteDocument(file: FileAccessType): Promise<undefined>;

    addComponentV2(file: FileAccessType, key: string, object: OpenAPIV2ComponentsObject, typeOfComponent: OpenAPIV2Components): Promise<OpenAPIV2.Document>;
    updateComponentV2(file: FileAccessType, prevKey: string,
        currentKey: string, object: OpenAPIV2ComponentsObject,
        typeOfComponent: OpenAPIV2Components): Promise<OpenAPIV2.Document>;
    deleteComponentV2(file: FileAccessType, key: string, typeOfComponent: OpenAPIV2Components): Promise<OpenAPIV2.Document>;
    setComponent: (file: FileAccessType, data: Record<string, OpenAPIV2ComponentsObject>, typeOfComponent: OpenAPIV2Components) => Promise<OpenAPIV2.Document>;


    setHostPathV2(file: FileAccessType, name: string | string[], type: OpenAPIV2HostPath): Promise<OpenAPIV2.Document>;
}