syntax = "proto3";

package actions;

option go_package = "gitea.boner.be/bdnugget/goonserver/actions";

message Action {
    enum ActionType {
        MOVE = 0;
        CHAT = 1;
        DISCONNECT = 2;
        LOGIN = 3;
        REGISTER = 4;
    }

    ActionType type = 1;
    int32 x = 2;
    int32 y = 3;
    int32 player_id = 4;
    string chat_message = 5;
    string username = 6;
    string password = 7;
}

message ActionBatch {
    int32 player_id = 1;
    repeated Action actions = 2;
    int64 tick = 3;
    int32 protocol_version = 4;
    int64 last_seen_message_timestamp = 5;
}

message PlayerState {
    int32 player_id = 1;
    int32 x = 2;
    int32 y = 3;
    string username = 4;
}

message ChatMessage {
    int32 player_id = 1;
    string username = 2;
    string content = 3;
    int64 timestamp = 4;
}

message ServerMessage {
    int32 player_id = 1;
    repeated PlayerState players = 2;
    int64 current_tick = 3;
    repeated ChatMessage chat_messages = 4;
    bool auth_success = 5;
    string error_message = 6;
    int32 protocol_version = 7;
}
