/* © SRSoftware 2025 */
package de.srsoftware.umbrella.messagebus.events;

import static de.srsoftware.umbrella.core.constants.Module.BOOKMARK;
import static de.srsoftware.umbrella.core.model.Translatable.t;

import de.srsoftware.umbrella.core.constants.Field;
import de.srsoftware.umbrella.core.model.Bookmark;
import de.srsoftware.umbrella.core.model.Translatable;
import de.srsoftware.umbrella.core.model.UmbrellaUser;
import java.util.Collection;
import java.util.List;

public class BookmarkEvent extends Event<Bookmark> {

	public BookmarkEvent(UmbrellaUser initiator, Bookmark bookmark, EventType type){
		super(initiator,BOOKMARK,bookmark,type);
	}
	@Override
	public Collection<UmbrellaUser> audience() {
		return List.of(initiator());
	}

	@Override
	public Translatable describe() {
		return switch (eventType()){
			case CREATE -> t("New bookmark created");
			case DELETE -> t("The bookmark '{url}' has been deleted", Field.URL, payload().url());
			case UPDATE -> t("Bookmark updated");
			default -> null;
		};
	}

	@Override
	public Translatable subject() {
		return describe();
	}


}
