import { LocalExecutionContext } from '../../execution/local.js';
import { HybridExecutionContext } from './hybrid.js';
import { RemoteExecutionContext } from './remote.js';
export class ExecutionContextFactory {
    static create(config) {
        switch (config.environment) {
            case 'local':
                return ExecutionContextFactory.createLocal({
                    id: config.id,
                    cwd: config.cwd,
                    fsAccess: config.fsAccess,
                    envVars: config.envVars,
                    capabilities: config.capabilities,
                    shell: config.shell,
                });
            case 'remote':
                return ExecutionContextFactory.createRemote({
                    id: config.id,
                    target: config.target,
                    capabilities: config.capabilities,
                });
            case 'hybrid':
                return ExecutionContextFactory.createHybrid({
                    id: config.id,
                    local: config.local,
                    remotes: config.remotes,
                    routingStrategy: config.routingStrategy,
                });
            default: {
                const _exhaustive = config;
                throw new Error(`Unhandled execution environment: ${JSON.stringify(_exhaustive)}`);
            }
        }
    }
    static createLocal(options) {
        return new LocalExecutionContext(options);
    }
    static createRemote(options) {
        return new RemoteExecutionContext(options);
    }
    static createHybrid(options) {
        return new HybridExecutionContext(options);
    }
}
//# sourceMappingURL=factory.js.map