package legion.muyue.best2048.data;

import com.google.gson.annotations.SerializedName;

public class GameStateResponse {
    @SerializedName("gameId")
    private String gameId;
    @SerializedName("board")
    private int[][] board; // Plateau de jeu actuel
    @SerializedName("player1Score")
    private int player1Score;
    @SerializedName("player2Score")
    private int player2Score;
    @SerializedName("currentPlayerId") // ID du joueur dont c'est le tour
    private String currentPlayerId;
    @SerializedName("isGameOver")
    private boolean isGameOver;
    @SerializedName("winnerId") // ID du gagnant si terminé, null sinon
    private String winnerId;
    @SerializedName("status")
    private String status;

    // --- Getters ---
    public String getGameId() { return gameId; }
    public int[][] getBoard() { return board; }
    public int getPlayer1Score() { return player1Score; }
    public int getPlayer2Score() { return player2Score; }
    public String getCurrentPlayerId() { return currentPlayerId; }
    public boolean isGameOver() { return isGameOver; }
    public String getWinnerId() { return winnerId; }
    public String getStatus() { return status; }

    // --- Méthode utilitaire pour obtenir le score de l'adversaire ---
    public int getOpponentScore(String myPlayerId) {
        if (myPlayerId == null) return 0;
        // TODO: Logique pour déterminer qui est player1/player2 basée sur l'API
        // Supposons pour l'instant que player1 est l'hôte, player2 l'invité
        // Et que l'API nous donne l'ID de player1/player2 dans un autre champ (ex: GameInfo)
        // Placeholder:
        return (myPlayerId.equals("player1_placeholder")) ? player2Score : player1Score;
    }
    public int getMyScore(String myPlayerId) {
        if (myPlayerId == null) return 0;
        // Placeholder:
        return (myPlayerId.equals("player1_placeholder")) ? player1Score : player2Score;
    }
}