import { BaseOpenApiV3_1ConverterNode, } from "../../BaseOpenApiV3_1Converter.node";
import { extendType } from "../../utils/extendType";
import { X_FERN_BASE_PATH } from "./fernExtension.consts";
export class XFernBasePathConverterNode extends BaseOpenApiV3_1ConverterNode {
    basePath;
    constructor(args) {
        super(args);
        this.safeParse();
    }
    parse() {
        this.basePath = extendType(this.input)[X_FERN_BASE_PATH];
        if (this.basePath != null) {
            if (this.basePath.startsWith("/")) {
                this.basePath = this.basePath.slice(1);
            }
            if (this.basePath.endsWith("/")) {
                this.basePath = this.basePath.slice(0, -1);
            }
        }
        else {
            this.basePath = undefined;
        }
    }
    convert() {
        return this.basePath;
    }
}
