import { XcodeProject as OldXcodeProject } from './XcodeProject.js';
import { SwiftPackage as OldSwiftPackage } from './SwiftPackage.js';
import { XcodeProject as NewXcodeProject } from '../../projects/xcode/XcodeProject.js';
import { SwiftPackage as NewSwiftPackage } from '../../projects/swift-package/SwiftPackage.js';
import { ProjectDiscovery } from '../../projects/ProjectDiscovery.js';
import { createModuleLogger } from '../../logger.js';
const logger = createModuleLogger('Xcode');
/**
 * Backward compatibility wrapper for Xcode project discovery.
 * Delegates to the new ProjectDiscovery class.
 * @deprecated Use ProjectDiscovery directly
 */
export class Xcode {
    projectDiscovery;
    constructor() {
        this.projectDiscovery = new ProjectDiscovery();
    }
    /**
     * Open a project at the specified path.
     * Returns the old interface for backward compatibility.
     */
    async open(projectPath) {
        logger.debug({ projectPath }, 'Opening project (backward compatibility mode)');
        // Use new discovery
        const project = await this.projectDiscovery.discover(projectPath);
        // Convert to old interface for backward compatibility
        if (project instanceof NewXcodeProject) {
            return new OldXcodeProject(project.path, project.type === 'xcworkspace' ? 'workspace' : 'project');
        }
        else if (project instanceof NewSwiftPackage) {
            return new OldSwiftPackage(project.path);
        }
        throw new Error(`Unknown project type at: ${projectPath}`);
    }
}
//# sourceMappingURL=Xcode2.js.map