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 java.util.List;

public class SSCategorie {

    public static void sendAddCategory(WebSocketConnection connection, CategoryModel category) {
        SSCategorie.sendAddCategory(connection, RCategorie.JustCategorie.from(category));
    }

    public static void sendAddCategory(WebSocketConnection connection, RCategorie.JustCategorie justCategorie) {
        CompetitionWS.sendNotifyToOtherEditor(connection, "sendAddCategory", justCategorie);
    }

    public static void sendCategory(WebSocketConnection connection, CategoryModel category) {
        SSCategorie.sendCategory(connection, RCategorie.JustCategorie.from(category));
    }

    public static void sendCategory(WebSocketConnection connection, RCategorie.JustCategorie justCategorie) {
        CompetitionWS.sendNotifyToOtherEditor(connection, "sendCategory", justCategorie);
    }

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

    public static void sendDelCategory(WebSocketConnection connection, Long id) {
        CompetitionWS.sendNotifyToOtherEditor(connection, "sendDelCategory", id);
    }
}
