/*
 * Copyright 2026, Jaime Terrats.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Messages } from '@salesforce/core';
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
import { getOfflineGuide } from '../../../services/offline-recovery.js';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@jterrats/setup-agents', 'setup-agents.offline.guide');
export default class OfflineGuide extends SfCommand {
    static summary = messages.getMessage('summary');
    static description = messages.getMessage('description');
    static examples = messages.getMessages('examples');
    static flags = {
        task: Flags.string({
            char: 't',
            summary: messages.getMessage('flags.task.summary'),
            required: true,
        }),
    };
    async run() {
        const { flags } = await this.parse(OfflineGuide);
        const cwd = process.cwd();
        const guide = getOfflineGuide(cwd, flags.task);
        this.log('');
        this.log(`Offline Guide: ${flags.task}`);
        this.log('═══════════════════════');
        if (!guide.task) {
            this.log(`\nTask "${flags.task}" not found in local state.`);
            this.log('Run `sf setup-agents task list` to see available tasks.');
            return guide;
        }
        this.log(`\nTask: ${guide.task.summary} [${guide.task.status}]`);
        if (guide.phase) {
            this.log(`Phase: ${guide.phase}`);
        }
        if (guide.run) {
            this.log(`Run: ${guide.run.id} [${guide.run.status}]`);
        }
        if (guide.steps.length > 0) {
            this.log('\nSteps:');
            for (const step of guide.steps) {
                this.log(`  ${step}`);
            }
        }
        if (guide.references.length > 0) {
            this.log('\nReferences:');
            for (const ref of guide.references) {
                this.log(`  → ${ref}`);
            }
        }
        if (guide.commands.length > 0) {
            this.log('\nCommands:');
            for (const cmd of guide.commands) {
                this.log(`  $ ${cmd}`);
            }
        }
        return guide;
    }
}
//# sourceMappingURL=guide.js.map