# src/core/actions.gd
class_name Actions
extends RefCounted

class Action:
    extends RefCounted
    var player_idx: int
    var action_type: String
    var cards: Array = []
    var seq_id: int = 0
    var nonce: int = 0
    var timestamp: int = 0

    func _to_string() -> String:
        return "Action(seq=%d, player=%d, type=%s, cards=%d)" % [seq_id, player_idx, action_type, cards.size()]

class GameStateSnapshot:
    extends RefCounted
    var game_state: Dictionary

class Team:
    extends RefCounted
    var team_id: int
    var player_indices: Array[int] = []
    var score: int = 0
    var current_level: int = 2

    static func create_team(team_id: int, p1: int, p2: int) -> Team:
        var t := Team.new()
        t.team_id = team_id
        t.player_indices = [p1, p2]
        return t

    func teammate_of(player_idx: int) -> int:
        if player_indices[0] == player_idx:
            return player_indices[1]
        return player_indices[0]

    func contains(player_idx: int) -> bool:
        return player_idx in player_indices
