package eu.jonahbauer.wizard.common.messages.server;

import eu.jonahbauer.wizard.common.messages.data.PlayerData;
import lombok.EqualsAndHashCode;
import lombok.Getter;

import java.util.List;
import java.util.UUID;

@Getter
@EqualsAndHashCode(callSuper = true)
public final class SessionJoinedMessage extends ServerMessage implements Response {
    /**
     * UUID of joined session
     */
    private final UUID session;
    /**
     * UUID assigned to the player
     */
    private final UUID player;
    /**
     * List of players already in the session
     */
    private final List<PlayerData> players;
    /**
     * Secret notified to player in order to ensure that if necessary the correct player rejoins
     */
    private final String secret;

    public SessionJoinedMessage(UUID session, UUID player, List<PlayerData> players, String secret) {
        this.session = session;
        this.player = player;
        this.players = List.copyOf(players);
        this.secret = secret;
    }
}
