package thyyxxk.webserver.http.websocket.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class WebSocketByListUserCode {
    private Set<String> sidList;
    private String msg;

    @Builder.Default
    private String mode = "MULTI";

    public static WebSocketByListUserCode create(Set<String> sidList, String msg) {
        return WebSocketByListUserCode.builder()
                .mode("MULTI")
                .sidList(sidList)
                .msg(msg)
                .build();
    }

    public static WebSocketByListUserCode create(List<String> sidList, String msg) {
        return WebSocketByListUserCode.builder()
                .mode("MULTI")
                .sidList(new HashSet<>(sidList))
                .msg(msg)
                .build();
    }
}
