export class RemoveRepositoryFromDashboardUseCase {
    deps;
    constructor(deps) {
        this.deps = deps;
    }
    execute(input) {
        let result;
        try {
            result = this.deps.removeRepositoryFromConfig.execute({
                configPath: this.deps.configPath,
                localPath: input.localPath,
            });
        }
        catch {
            return { status: 'write-failed' };
        }
        if (!result.removed) {
            return { status: 'not-found' };
        }
        const index = this.deps.repositories.findIndex((repository) => repository.localPath === input.localPath);
        if (index >= 0) {
            this.deps.repositories.splice(index, 1);
        }
        return { status: 'ok', repositories: this.deps.repositories };
    }
}
//# sourceMappingURL=removeRepositoryFromDashboard.usecase.js.map