"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InterfaceDriver = void 0;
class InterfaceDriver {
    static getInterface(sourceFile, interfaceName) {
        return sourceFile.getInterface(interfaceName);
    }
    static addInterface(sourceFile, interfaceName, properties, { overwrite = false, } = {}) {
        // avoid duplicate interfaces in same file
        const interfaceInstance = sourceFile.getInterface(interfaceName);
        if (interfaceInstance) {
            if (overwrite) {
                interfaceInstance.remove();
            }
            else {
                return;
            }
        }
        const interfaceDeclaration = sourceFile.addInterface({
            name: interfaceName,
        });
        interfaceDeclaration.addProperties(properties);
        // export interface declaration
        interfaceDeclaration.setIsExported(true);
        return interfaceDeclaration;
    }
    static addProperty(interfaceDeclaration, property) {
        interfaceDeclaration.addProperty(property);
        return interfaceDeclaration;
    }
}
exports.InterfaceDriver = InterfaceDriver;
