import { BaseApiConverterNode, BaseApiConverterNodeContext, } from "../BaseApiConverter.node";
import { toOpenApiPath } from "./utils/toOpenApiPath";
export class BaseOpenApiV3_1ConverterNodeContext extends BaseApiConverterNodeContext {
}
export class BaseOpenApiV3_1ConverterNode extends BaseApiConverterNode {
    context;
    accessPath;
    pathId;
    constructor({ input, context, accessPath, pathId, }) {
        super(input, context);
        this.context = context;
        this.accessPath = [...accessPath];
        this.pathId = pathId;
        if (pathId != null) {
            const pathIdArray = Array.isArray(this.pathId)
                ? this.pathId
                : [this.pathId];
            if (!pathIdArray.every((id, index) => id ===
                this.accessPath[this.accessPath.length - pathIdArray.length + index])) {
                this.accessPath.push(...pathIdArray);
            }
        }
        context.logger.debug(`Processing ${toOpenApiPath(this.accessPath)}`);
    }
    safeParse(...additionalArgs) {
        try {
            this.parse(...additionalArgs);
        }
        catch {
            this.context.errors.error({
                message: "Error converting node. Please contact support if the error persists",
                path: this.accessPath,
            });
        }
    }
}
export class BaseOpenApiV3_1ConverterNodeWithExample extends BaseOpenApiV3_1ConverterNode {
}
export class BaseOpenApiV3_1ConverterNodeWithTracking extends BaseOpenApiV3_1ConverterNodeWithExample {
    seenSchemas;
    constructor(args) {
        super(args);
        this.seenSchemas = new Set(args.seenSchemas);
    }
}
