/*
 * 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 { sprintPath, startSprint } from '../../../../services/workflow-velocity.js';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@jterrats/setup-agents', 'setup-agents.workflow.sprint.start');
export default class WorkflowSprintStart extends SfCommand {
    static summary = messages.getMessage('summary');
    static description = messages.getMessage('description');
    static examples = messages.getMessages('examples');
    static flags = {
        sprint: Flags.string({
            summary: messages.getMessage('flags.sprint.summary'),
            description: messages.getMessage('flags.sprint.description'),
            required: true,
        }),
        'start-date': Flags.string({
            summary: messages.getMessage('flags.start-date.summary'),
            description: messages.getMessage('flags.start-date.description'),
            required: true,
        }),
        'end-date': Flags.string({
            summary: messages.getMessage('flags.end-date.summary'),
            description: messages.getMessage('flags.end-date.description'),
            required: true,
        }),
        capacity: Flags.integer({
            summary: messages.getMessage('flags.capacity.summary'),
            description: messages.getMessage('flags.capacity.description'),
            required: true,
        }),
    };
    async run() {
        const { flags } = await this.parse(WorkflowSprintStart);
        const cwd = process.cwd();
        const file = sprintPath(cwd);
        const record = startSprint(cwd, {
            sprintId: flags.sprint,
            startDate: flags['start-date'],
            endDate: flags['end-date'],
            capacityDays: flags.capacity,
        });
        this.log(messages.getMessage('info.created', [
            record.id,
            record.sprintId,
            record.startDate,
            record.endDate,
            record.capacityDays,
        ]));
        return { record, file, cwd };
    }
}
//# sourceMappingURL=start.js.map