syntax = "proto3";

package twitch.video.usher;
option go_package = "code.justin.tv/video/usherapi/rpc/usher";

// Based on the get_api_channel_livecheck API in Usher
// https://git-aws.internal.justin.tv/video/usher/blob/e1878d583825e7202707838e8f856c7f1fcef730/api/get_hls.py#L50
message ChannelLiveCheckRequest {
    string channel_id = 1 [json_name = "channel_id"];
}

// Example response from the LiveCheck API:
//  [
//      {
//       "channel_id": "27446517",
//       "video_height": 1080,
//       "session_id": "a02bce9a-e0c1-4ab8-b6eb-47006ee44746",
//       "started_on": "1528874483",
//       "stream_id": "29072188464",
//       "broadcaster": "unknown_rtmp",
//       "average_fps": 30.0429184549,
//       "updated_on": "1529005457",
//       "channel": "monstercat"
//     }
// ]

message ChannelLiveCheckResponse {
    // channel_id is the identifier for a channel in the Twitch users database
    int64 channel_id = 1 [json_name = "channel_id"];

    // video_height_pixels is the height of the output video for this rendition in
    // pixels.
    int32 video_height_pixels = 2 [json_name = "video_height"];

    // session_id is a unique Session ID for the broadcast.
    string session_id = 3 [json_name = "session_id"];

    // start_time_seconds is the time at which the broadcast started. Unix time in seconds.
    int64 start_time_seconds = 4 [json_name = "started_on"];

    // stream_id is a key used in queries for streams.
    int64 stream_id = 5 [json_name = "stream_id"];

    // broadcaster is read from the broadcast_tag typically, and is used to indicate
    // when special broadcast integrations are in use (rebroadcasts, delay, etc)
    string broadcaster = 6 [json_name = "broadcaster"];

    // average_fps is the average framerate of this stream
    double average_fps = 7 [json_name= "average_fps"];

    // update_time_seconds is the most recent timestamp, in Unix seconds, that any
    // field of this object was changed.
    int64 update_time_seconds = 8 [json_name = "updated_on"];

    // channel is the twitch channel name. this field should not be used for any
    // purpose other than display, channel_id should be used instead to identify
    // channels
    string channel = 9 [json_name = "channel"];
}
