export class UpdateRepositoryEnabledFromDashboardUseCase {
    deps;
    constructor(deps) {
        this.deps = deps;
    }
    execute(input) {
        let result;
        try {
            result = this.deps.toggleRepositoryEnabled.execute({
                configPath: this.deps.configPath,
                localPath: input.localPath,
                enabled: input.enabled,
            });
        }
        catch {
            return { status: 'write-failed' };
        }
        if (!result.updated) {
            return { status: 'not-found' };
        }
        const target = this.deps.repositories.find((repository) => repository.localPath === input.localPath);
        if (target) {
            target.enabled = input.enabled;
        }
        return { status: 'ok', repositories: this.deps.repositories };
    }
}
//# sourceMappingURL=updateRepositoryEnabledFromDashboard.usecase.js.map