import { defaultProjectArchiveCommandDependencies, runArchiveSyncCommand, } from '../../project/archive/sync-runner.js';
import { readGlobalOptions } from '../../shared/shared.utils.js';
import { Command } from 'commander';
export function createRepoArchiveCommand(overrides = {}) {
    const dependencies = {
        ...defaultProjectArchiveCommandDependencies(),
        ...overrides,
    };
    return new Command('archive')
        .description('Manage repository archive data')
        .addCommand(new Command('sync')
        .description('Sync archived project data from S3 into the local archive')
        .argument('[project-name]', 'Archived project name to sync')
        .option('--dry-run', 'Preview archive sync without downloading')
        .option('--force', 'Replace the named local archive before syncing it from S3')
        .option('--profile <profile>', 'AWS profile override for this sync')
        .option('--region <region>', 'AWS region override for this sync')
        .action(async (projectName, options, command) => {
        const context = dependencies.buildCommandContext(readGlobalOptions(command));
        await runArchiveSyncCommand(dependencies, projectName, options, context, 'oat repo archive sync');
    }));
}
