package tag;

import java.util.Collection;
import java.util.Optional;

public record OptionalTag(Optional<Tag> tag) {

	public Optional<Tag> getTag() {
		return tag;
	}

	public static OptionalTag of(Tag tag) {
		return new OptionalTag(Optional.of(tag));
	}

	public static OptionalTag empty() {
		return new OptionalTag(Optional.empty());
	}

	void addTo(Collection<Tag> collection) {
		if (tag.isPresent()) collection.add(tag.get());
	}
}
