import { FernRegistry } from "../../../client/generated";
import { BaseOpenApiV3_1ConverterNode, } from "../../BaseOpenApiV3_1Converter.node";
import { extendType } from "../../utils/extendType";
import { X_FERN_GROUP_NAME } from "./fernExtension.consts";
export class XFernGroupNameConverterNode extends BaseOpenApiV3_1ConverterNode {
    groupName;
    constructor(args) {
        super(args);
        this.safeParse();
    }
    // This would be used to set a member on the node
    parse() {
        this.groupName = extendType(this.input)[X_FERN_GROUP_NAME];
    }
    convert() {
        if (this.groupName == null) {
            return undefined;
        }
        let subpackagePath;
        if (Array.isArray(this.groupName)) {
            subpackagePath = this.groupName;
        }
        else {
            subpackagePath = [this.groupName];
        }
        return subpackagePath.map((path) => FernRegistry.api.v1.SubpackageId(path));
    }
}
