syntax = "proto3";

package Aurora.Proto.Events;

import "Proto/general.proto";
import "Proto/party.proto";

service RemoteEventService {
    //Party Service
    rpc GetEvents(EventsRequest) returns (stream BaseEvent) {};
    rpc SubscribeToEvents(SubscribeRequest) returns(SubscriptionResponse);
    rpc UnsubscribeFromEvents(UnsubscribeRequest) returns (SubscriptionResponse);
    rpc UnsubscribeFromAll(UnsubscribeAllRequest) returns (SubscriptionResponse);
}

message EventsRequest {
    string clientId = 1;
}

/* Subscription messages */
message SubscribeRequest {
    repeated EventType eventTypes = 1;
    string clientId = 2;
}

message UnsubscribeRequest {
    repeated EventType eventTypes = 1;
    string clientId = 2;
}

message UnsubscribeAllRequest {
    string clientId = 1;
}

message SubscriptionResponse {
    bool successful = 1;
}

/* Event Types */
enum EventType {
    PartyMemberJoined = 0;
    PartyMemberLeft = 1;
}
message BaseEvent {
    EventType eventType = 1;
    string clientKey = 2;
    
    oneof derivedEvent {
        PartyMemberJoinedEvent partyMemberJoinedEvent = 3;
        PartyMemberLeftEvent partyMemberLeftEvent = 4;
    }
}

message PartyMemberJoinedEvent {
    Aurora.Proto.Party.PartyMember member = 3;
}

message PartyMemberLeftEvent {
    Aurora.Proto.Party.PartyMember member = 3;
}