package category;

import java.util.Set;

public class CategoryUseCase {

	private final CategoryRepository categoryRepository;
	private final CategoryIdGenerator categoryIdGenerator;

	public CategoryUseCase(final CategoryRepository categoryRepository, final CategoryIdGenerator idGenerator) {
		this.categoryRepository = categoryRepository;
		this.categoryIdGenerator = idGenerator;
	}

	public void addCategory(CategoryName name) {
		var id = this.categoryIdGenerator.generateId();
		this.categoryRepository.add(new Category(name, id));
	}

	public Set<Category> getCategories() {
		return categoryRepository.getAll();
	}
}
