syntax = "proto3";
package video.multiplex.internal.multiplexv2;
option go_package = "multiplexv2";

import "code.justin.tv/video/usherapi/rpc/usher/channel.proto";
import "code.justin.tv/video/usherapi/rpc/usher/channel_properties.proto";
import "code.justin.tv/video/usherapi/rpc/usher/hls_transcode.proto";
import "code.justin.tv/video/usherapi/rpc/usher/stream.proto";
import "code.justin.tv/video/digestion/pkg/dgn/dgn.proto";

message ResponseMeta {
  // Whether an error occurred
  bool error_occurred = 1;
  // The HTTP status code of the response
  int32 status_code = 2;
  // The twirp code of the response
  string twirp_code = 3;
  // The error message, if an error occurred
  string error_message = 4;
}

message ChannelLiveCheckRequest {
  twitch.video.usher.ChannelLiveCheckRequest request = 1;
}
message ChannelLiveCheckResponse {
  repeated ChannelLiveCheckRegionalResponse responses = 1;
}
message ChannelLiveCheckRegionalResponse {
  twitch.video.usher.ChannelLiveCheckResponse response = 1;
  ResponseMeta meta = 2;
  string origin = 3;
}

message ChannelPropertiesListRequest {
  twitch.video.usher.ChannelPropertiesListRequest request = 1;
}
message ChannelPropertiesListResponse {
  repeated ChannelPropertiesListRegionalResponse responses = 1;
}
message ChannelPropertiesListRegionalResponse {
  twitch.video.usher.ListOf_ChannelPropertiesListResponse response = 1;
  ResponseMeta meta = 2;
  string origin = 3;
}

message ChannelPropertiesLiveHLSChannelsRequest {
  twitch.video.usher.ChannelPropertiesLiveHLSChannelsRequest request = 1;
}
message ChannelPropertiesLiveHLSChannelsResponse {
  repeated ChannelPropertiesLiveHLSChannelsRegionalResponse responses = 1;
}
message ChannelPropertiesLiveHLSChannelsRegionalResponse {
  twitch.video.usher.ChannelPropertiesLiveHLSChannelsResponse response = 1;
  ResponseMeta meta = 2;
  string origin = 3;
}

message HLSTranscodeShowChannelRequest {
  twitch.video.usher.HLSTranscodeShowChannelRequest request = 1;
}
message HLSTranscodeShowChannelResponse {
  repeated HLSTranscodeShowChannelRegionalResponse responses = 1;
}
message HLSTranscodeShowChannelRegionalResponse {
  twitch.video.usher.HLSTranscode response = 1;
  ResponseMeta meta = 2;
  string origin = 3;
}

message StreamForceReplicationByChannelIdRequest {
  twitch.video.usher.StreamForceReplicationByChannelIdRequest request = 1;
}
message StreamForceReplicationByChannelIdResponse {
  repeated StreamForceReplicationByChannelIdRegionalResponse responses = 1;
}
message StreamForceReplicationByChannelIdRegionalResponse {
  twitch.video.usher.StreamForceReplicationByChannelIdResponse response = 1;
  ResponseMeta meta = 2;
  string origin = 3;
}

message StreamMinuteBroadcastsRequest{
  twitch.video.usher.StreamMinuteBroadcastsRequest request = 1;
}
message StreamMinuteBroadcastsResponse {
  repeated StreamMinuteBroadcastsRegionalResponse responses = 1;
}
message StreamMinuteBroadcastsRegionalResponse {
  twitch.video.usher.ListOf_StreamMinuteBroadcastsResponse response = 1;
  ResponseMeta meta = 2;
  string origin = 3;
}

message DisconnectChannelRequest {
  dgn.ChannelRequest request = 1;
}
message DisconnectChannelResponse {
  repeated DisconnectChannelRegionalResponse responses = 1;
}
message DisconnectChannelRegionalResponse {
  dgn.Channel response = 1;
  ResponseMeta meta = 2;
  string origin = 3;
}

service MultiplexV2 {
  rpc ChannelLiveCheck(ChannelLiveCheckRequest) returns (ChannelLiveCheckResponse) {}
  rpc ChannelPropertiesList(ChannelPropertiesListRequest) returns (ChannelPropertiesListResponse) {}
  rpc ChannelPropertiesLiveHLSChannels(ChannelPropertiesLiveHLSChannelsRequest) returns (ChannelPropertiesLiveHLSChannelsResponse) {}
  rpc HLSTranscodeShowChannel(HLSTranscodeShowChannelRequest) returns (HLSTranscodeShowChannelResponse) {}
  rpc StreamForceReplicationByChannelId(StreamForceReplicationByChannelIdRequest) returns (StreamForceReplicationByChannelIdResponse) {}
  rpc StreamMinuteBroadcasts(StreamMinuteBroadcastsRequest) returns (StreamMinuteBroadcastsResponse) {}
  rpc DisconnectChannel(DisconnectChannelRequest) returns (DisconnectChannelResponse) {}
}
