namespace Server.Networking.Messages;
///
/// Network message operation codes for client-server communication
///
public static class OpCodes
{
///
/// Echo test message - server echoes back the received payload
///
public const int ECHO = 1;
///
/// Server -> Client: Keepalive ping message to prevent idle timeout
/// Client should respond with PONG to reset idle timer
///
public const int PING = 2;
///
/// Client -> Server: Response to PING message
/// Indicates client is still alive and responsive
///
public const int PONG = 3;
// ===== Authentication (100-119) =====
///
/// Client -> Server: Register new account
/// Payload: { username: string, password: string }
///
public const int AUTH_REGISTER = 100;
///
/// Server -> Client: Registration result
/// Payload: { success: bool, message: string, accountId?: int }
///
public const int AUTH_REGISTER_RESULT = 101;
///
/// Client -> Server: Login with username and password
/// Payload: { username: string, password: string }
///
public const int AUTH_LOGIN = 110;
///
/// Server -> Client: Login result
/// Payload: { success: bool, message: string, token?: string }
///
public const int AUTH_LOGIN_RESULT = 111;
///
/// Client -> Server: Authenticate using stored token
/// Payload: { token: string }
///
public const int AUTH_WITH_TOKEN = 112;
///
/// Server -> Client: Token authentication result
/// Payload: { success: bool, message: string }
///
public const int AUTH_WITH_TOKEN_RESULT = 113;
// ===== Character Management (200-219) =====
///
/// Client -> Server: Create new character
/// Payload: { name: string }
///
public const int CHAR_CREATE = 202;
///
/// Server -> Client: Character creation result
/// Payload: { success: bool, message: string, character?: object }
///
public const int CHAR_CREATE_RESULT = 203;
///
/// Client -> Server: Select character to play
/// Payload: { characterId: int }
///
public const int CHAR_SELECT = 204;
///
/// Server -> Client: Character selection result
/// Payload: { success: bool, message: string }
///
public const int CHAR_SELECT_RESULT = 205;
// ===== World/Overworld (300-319) =====
///
/// Client -> Server: Request to spawn in world after character selection
///
public const int WORLD_SPAWN_REQUEST = 300;
///
/// Server -> Client: Spawn notification (your own character or other players joining)
///
public const int WORLD_SPAWN = 301;
///
/// Server -> Client: Despawn notification (player leaving)
///
public const int WORLD_DESPAWN = 302;
///
/// Client -> Server: Player input (movement, actions)
/// Sent at ~20 Hz or per tick
///
public const int WORLD_INPUT = 310;
///
/// Server -> Client: World state snapshot
/// Sent at ~10-20 Hz
///
public const int WORLD_STATE = 311;
// ===== Error Messages (900-999) =====
///
/// Server -> Client: General error message
/// Payload: { error: string }
///
public const int ERROR = 900;
}