import BaseWorkspacesGenerator from '../base-workspaces/index.js';
export default class DockerComposeGenerator extends BaseWorkspacesGenerator {
    sharedWorkspaces;
    customWorkspacesConfig;
    async beforeQueue() {
        this.sharedWorkspaces = this.getSharedApplication().sharedWorkspaces;
        this.sharedWorkspaces.existingWorkspaces = this.sharedWorkspaces.existingWorkspaces ?? Boolean(this.jhipsterConfig.appsFolders);
        if (!this.fromBlueprint) {
            await this.composeWithBlueprints();
        }
    }
    get prompting() {
        return this.asPromptingTaskGroup({
            async askForOptions() {
                if (this.customWorkspacesConfig || (this.sharedWorkspaces.existingWorkspaces && !this.options.askAnswered))
                    return;
                await this.askForWorkspacesConfig();
            },
        });
    }
    get [BaseWorkspacesGenerator.PROMPTING]() {
        return this.delegateTasksToBlueprint(() => this.prompting);
    }
    get configuring() {
        return this.asConfiguringTaskGroup({
            configureWorkspaces() {
                this.configureWorkspacesConfig();
            },
        });
    }
    get [BaseWorkspacesGenerator.CONFIGURING]() {
        return this.delegateTasksToBlueprint(() => this.configuring);
    }
    get loading() {
        return this.asLoadingTaskGroup({
            loadWorkspacesConfig() {
                this.loadWorkspacesConfig();
            },
        });
    }
    get [BaseWorkspacesGenerator.LOADING]() {
        return this.delegateTasksToBlueprint(() => this.loading);
    }
    get preparing() {
        return this.asPreparingTaskGroup({
            async bootstrapApplications() {
                await this.bootstrapApplications();
            },
        });
    }
    get [BaseWorkspacesGenerator.PREPARING]() {
        return this.delegateTasksToBlueprint(() => this.preparing);
    }
    get loadingWorkspaces() {
        return {
            loadWorkspacesConfig({ workspaces }) {
                this.loadWorkspacesConfig({ context: workspaces });
            },
        };
    }
    get [BaseWorkspacesGenerator.LOADING_WORKSPACES]() {
        return this.delegateTasksToBlueprint(() => this.loadingWorkspaces);
    }
}
