package fr.titionfire.ffsaf.ws.send;

import fr.titionfire.ffsaf.domain.entity.MatchEntity;
import fr.titionfire.ffsaf.ws.CompetitionWS;
import fr.titionfire.ffsaf.ws.recv.RMatch;
import io.quarkus.websockets.next.WebSocketConnection;
import io.smallrye.mutiny.Uni;

import java.util.List;

public class SSMatch {

    public static Uni<Void> sendMatch(WebSocketConnection connection, MatchEntity matchEntity) {
        return SSMatch.sendMatch(connection, List.of(matchEntity));
    }

    public static Uni<Void> sendMatch(WebSocketConnection connection, List<MatchEntity> matchEntities) {
        return CompetitionWS.sendNotifyToOtherEditor(connection, "sendMatch", matchEntities);
    }

    public static Uni<Void> sendMatchOrder(WebSocketConnection connection, RMatch.MatchOrder  matchOrder) {
        return CompetitionWS.sendNotifyToOtherEditor(connection, "sendMatchOrder", matchOrder);
    }

    public static Uni<Void> sendDeleteMatch(WebSocketConnection connection, Long l) {
        return SSMatch.sendDeleteMatch(connection, List.of(l));
    }

    public static Uni<Void> sendDeleteMatch(WebSocketConnection connection, List<Long> longs) {
        return CompetitionWS.sendNotifyToOtherEditor(connection, "sendDeleteMatch", longs);
    }
}
