/*
 * 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 { clarificationPath, listClarifications } from '../../../services/clarification.js';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@jterrats/setup-agents', 'setup-agents.workflow.clarify-list');
export default class WorkflowClarifyList extends SfCommand {
    static summary = messages.getMessage('summary');
    static description = messages.getMessage('description');
    static examples = messages.getMessages('examples');
    static flags = {
        run: Flags.string({
            summary: messages.getMessage('flags.run.summary'),
            description: messages.getMessage('flags.run.description'),
            required: true,
        }),
    };
    async run() {
        const { flags } = await this.parse(WorkflowClarifyList);
        const cwd = process.cwd();
        const records = listClarifications(cwd, flags.run);
        const file = clarificationPath(cwd);
        if (records.length === 0) {
            this.log(messages.getMessage('info.none', [flags.run]));
        }
        else {
            for (const r of records) {
                this.log(formatRecord(r));
            }
        }
        return { records, file, cwd };
    }
}
function formatRecord(r) {
    const status = r.status === 'open' ? '[open]' : '[answered]';
    const answered = r.answeredAt ? ` → ${r.answer ?? ''}` : '';
    return `${status} ${r.id} (${r.fromRole}→${r.toRole}): ${r.question}${answered}`;
}
//# sourceMappingURL=clarify-list.js.map