package fr.titionfire.ffsaf.ws.send;

import fr.titionfire.ffsaf.data.model.CategoryModel;
import fr.titionfire.ffsaf.domain.entity.TreeEntity;
import fr.titionfire.ffsaf.ws.CompetitionWS;
import fr.titionfire.ffsaf.ws.recv.RCategorie;
import io.quarkus.websockets.next.WebSocketConnection;
import io.smallrye.mutiny.Uni;

import java.util.List;

public class SSCategorie {

    public static Uni<Void> sendAddCategory(WebSocketConnection connection, CategoryModel category) {
        return SSCategorie.sendAddCategory(connection, RCategorie.JustCategorie.from(category));
    }

    public static Uni<Void> sendAddCategory(WebSocketConnection connection, RCategorie.JustCategorie justCategorie) {
        return CompetitionWS.sendNotifyToOtherEditor(connection, "sendAddCategory", justCategorie);
    }

    public static Uni<Void> sendCategory(WebSocketConnection connection, CategoryModel category) {
        return SSCategorie.sendCategory(connection, RCategorie.JustCategorie.from(category));
    }

    public static Uni<Void> sendCategory(WebSocketConnection connection, RCategorie.JustCategorie justCategorie) {
        return CompetitionWS.sendNotifyToOtherEditor(connection, "sendCategory", justCategorie);
    }

    public static Uni<Void> sendTreeCategory(WebSocketConnection connection, List<TreeEntity> treeEntities) {
        return CompetitionWS.sendNotifyToOtherEditor(connection, "sendTreeCategory", treeEntities);
    }
}
