package cli.link;
import category.CategoryName;
import link.LinkDto;
import link.LinkUrl;
import link.LinkUseCase;
import user.Username;
import java.util.Set;
import java.util.stream.Collectors;
public class LinkCliAdapter {
private final LinkUseCase linkUseCase;
public LinkCliAdapter(LinkUseCase linkUseCase) {
this.linkUseCase = linkUseCase;
}
public void addLink(String url, Set<String> categoryNames, String creator) {
linkUseCase.addLink(new LinkUrl(url),
categoryNames.stream().map(CategoryName::new).collect(Collectors.toSet()),
new Username(creator));
public Set<String> getLinks() {
return linkUseCase.getLinks().stream().map(LinkDto::toString).collect(Collectors.toSet());