syntax = "proto3"; package feedhub.edge.v1; import "google/protobuf/timestamp.proto"; option csharp_namespace = "FeedHub.Edge.V1"; service FeedEdge { rpc Subscribe(SubscribeRequest) returns (stream FeedEvent); rpc GetStatus(GetStatusRequest) returns (EdgeStatus); rpc PlaceBet(PlaceBetRequest) returns (PlaceBetReply); rpc ReadBetResults(ReadBetResultsRequest) returns (stream BetResultDelivery); rpc ConfirmBetResult(ConfirmBetResultRequest) returns (ConfirmBetResultReply); rpc GetBets(GetBetsRequest) returns (GetBetsReply); } enum Phase { PHASE_ANY = 0; PHASE_LIVE = 1; PHASE_PREMATCH = 2; } message SubscribeRequest { repeated string sport_ids = 1; repeated string tournament_ids = 2; Phase phase = 3; string resume_token = 4; } message FeedEvent { oneof body { StatusChanged status = 1; SnapshotBegin snapshot_begin = 2; SnapshotEnd snapshot_end = 3; EventChanged event = 4; MarketChanged market = 5; MarketRemoved market_removed = 6; EventWithdrawn event_withdrawn = 7; EventUnsubscribed event_unsubscribed = 8; } string resume_token = 15; } message SnapshotBegin {} message SnapshotEnd {} message EventChanged { reserved 2; reserved "feed_key"; string event_id = 1; google.protobuf.Timestamp fetched_at = 3; bool is_live = 4; bool is_finished = 5; EventContent content = 6; repeated ManifestEntry manifest = 7; } message EventContent { google.protobuf.Timestamp game_start = 1; string sport_id = 2; optional string country_id = 3; string tournament_id = 4; optional string team_a_id = 5; optional string team_b_id = 6; optional string prematch_event_id = 7; optional string score_full = 8; optional string score_period = 9; optional string score_extra = 10; optional string period_name = 11; optional string extra_time = 12; optional string pitch = 13; optional int32 timer = 14; EventKind kind = 15; optional string name = 16; } message ManifestEntry { string market_id = 1; string content_hash = 2; } message MarketChanged { reserved 3, 8; reserved "feed_key", "suspended"; string event_id = 1; string tournament_id = 2; MarketGroup group = 4; repeated Market markets = 5; string content_hash = 6; google.protobuf.Timestamp fetched_at = 7; string snapshot_key = 9; } message MarketGroup { reserved 1; reserved "key"; string name = 2; string id = 3; } message Market { string market_id = 1; string market_type_id = 2; optional string name = 3; int32 columns = 4; repeated SelectionRow rows = 5; bool suspended = 6; optional int32 split_number = 7; } message SelectionRow { repeated Selection selections = 1; } message Selection { reserved 2, 10; reserved "feed_key", "player_feed_key"; string selection_id = 1; optional string name = 3; string value = 4; bool is_suspended = 5; optional int32 column_index = 6; optional string line = 7; optional string participant_id = 8; int32 sort_order = 9; } message MarketRemoved { string event_id = 1; string market_id = 2; google.protobuf.Timestamp removed_at = 3; } message EventWithdrawn { string event_id = 1; google.protobuf.Timestamp withdrawn_at = 2; } message EventUnsubscribed { string event_id = 1; } message GetStatusRequest {} message StatusChanged { EdgeStatus status = 1; } message EdgeStatus { Status state = 1; DegradedReason reason = 2; google.protobuf.Timestamp since = 3; string edge_version = 4; repeated int32 wire_versions = 5; google.protobuf.Timestamp last_fetched_at = 6; optional double lag_seconds = 7; } enum Status { STATUS_UNSPECIFIED = 0; STATUS_READY = 1; STATUS_DEGRADED = 2; } enum DegradedReason { DEGRADED_REASON_UNSPECIFIED = 0; DEGRADED_REASON_LIVENESS = 1; DEGRADED_REASON_LIVE_LAG = 2; DEGRADED_REASON_ARRIVAL = 3; DEGRADED_REASON_STARTING = 4; DEGRADED_REASON_QUEUE_LAG = 5; } enum EventKind { EVENT_KIND_UNSPECIFIED = 0; EVENT_KIND_MATCH = 1; EVENT_KIND_OUTRIGHT = 2; EVENT_KIND_UNRECOGNIZED = 3; } message PlaceBetRequest { reserved 3; reserved "selection_feed_key"; string client_bet_key = 1; string market_id = 2; string price = 4; string stake = 5; bool accept_price_changes = 6; bool is_live = 7; string selection_id = 8; } message PlaceBetReply { string client_bet_key = 1; optional string bet_id = 2; PlaceBetOutcome outcome = 3; optional string current_price = 4; optional string problem = 5; } enum PlaceBetOutcome { PLACE_BET_OUTCOME_UNSPECIFIED = 0; PLACE_BET_OUTCOME_ACCEPTED = 1; PLACE_BET_OUTCOME_PRICE_CHANGED = 2; PLACE_BET_OUTCOME_SUSPENDED = 3; PLACE_BET_OUTCOME_UNAVAILABLE = 4; PLACE_BET_OUTCOME_FAILED = 5; PLACE_BET_OUTCOME_REFUSED = 6; PLACE_BET_OUTCOME_CONFLICT = 7; PLACE_BET_OUTCOME_UNRECOGNIZED = 8; } message ReadBetResultsRequest {} message BetResultDelivery { string delivery_id = 1; SettledBet result = 2; } message SettledBet { string bet_id = 1; string client_bet_key = 2; SettlementResult result = 3; google.protobuf.Timestamp settled_at = 4; } enum SettlementResult { SETTLEMENT_RESULT_UNSPECIFIED = 0; SETTLEMENT_RESULT_WIN = 1; SETTLEMENT_RESULT_LOSS = 2; SETTLEMENT_RESULT_VOID = 3; SETTLEMENT_RESULT_HALF_WIN = 4; SETTLEMENT_RESULT_HALF_LOSS = 5; SETTLEMENT_RESULT_UNRECOGNIZED = 6; } message ConfirmBetResultRequest { string delivery_id = 1; } message ConfirmBetResultReply {} message GetBetsRequest { repeated string bet_ids = 1; repeated string client_bet_keys = 2; } message GetBetsReply { repeated BetStatus bets = 1; } message BetStatus { optional string bet_id = 1; optional string client_bet_key = 2; BetStatusState state = 3; optional PlaceBetOutcome outcome = 4; optional string current_price = 5; optional SettlementResult result = 6; google.protobuf.Timestamp settled_at = 7; } enum BetStatusState { BET_STATUS_STATE_UNSPECIFIED = 0; BET_STATUS_STATE_NOT_FOUND = 1; BET_STATUS_STATE_PLACING = 2; BET_STATUS_STATE_NOT_PLACED = 3; BET_STATUS_STATE_OPEN = 4; BET_STATUS_STATE_SETTLED = 5; BET_STATUS_STATE_EXPIRED = 6; BET_STATUS_STATE_UNRECOGNIZED = 7; }