package tag;

import link.LinkUrl;
import link.RandomLinkIdGenerator;

import java.util.HashSet;
import java.util.Set;

public class TaggingUseCase {

	TagMatcherRepository tagMatcherRepository;

	public TaggingUseCase(TagMatcherRepository tagMatcherRepository, RandomLinkIdGenerator randomLinkIdGenerator) {
		this.tagMatcherRepository = tagMatcherRepository;
	}

	public Set<Tag> getTagsFor(LinkUrl url) {
		Set<Tag> result = new HashSet<>();
		tagMatcherRepository.getTagMatchers().forEach(tagMatcher -> tagMatcher.ifMatches(url).addTo(result));
		return result;
	}
}
