/*
 * Created by jonathan.jesperson@pluto.tv on 10/21/2020.
 * Copyright (c) PlutoTV Inc 2020.
 */

syntax = "proto3";

package sequencerpackage;

option go_package = "github.com/Pluto-tv/service-dal/golang_client";
option java_package = "tv.pluto.ip.dal.sequencer";

service SequencerManager {
  // GetHydratedEpisode (Unary)
  //
  rpc GetHydratedEpisode(GetHydratedEpisodeRequest) returns (GetHydratedEpisodeResponse) {}

  // GetHydratedTimeline (Unary)
  //
  rpc GetHydratedTimeline(GetHydratedTimelineRequest) returns (GetHydratedTimelineResponse) {}
}

message GetHydratedEpisodeRequest {
  string id = 1;
}
message GetHydratedEpisodeResponse {
  Episode episode = 1;
}

message GetHydratedTimelineRequest {
  string id = 1;
}

message GetHydratedTimelineResponse {
  Timeline timeline = 1;
}

message Timeline {
  string id = 1;
  string start = 2;
  string stop = 3;
  Episode episode = 4;
  string channel = 5;
  ChannelPopulated channel_populated = 6;
}

message Distribution {
  repeated string include = 1;
  repeated string exclude = 2;
}

message ChannelPopulated {
  string id = 1;
  Distribution distribution = 2;
}

message Episode {
  string id = 1;
  string name = 2;
  Series series = 3;
  int32 duration = 4;
  int32 allotment = 5;
  int32 ad_pods_duration = 6;
  string category = 7;
  string sub_category = 8;
  string genre = 9;
  string sub_genre = 10;
  repeated Source sources = 11;
  bool dash_enabled = 12;
  repeated AgeRange age_range = 13;
  string active_region = 14;
  // kids_mode is true if any of the underlying vod_categories have kids_mode true
  bool kids_mode = 15;
  string display_name = 16;
}

message AgeRange {
  string id = 1;
  string name = 2;
  string display_name = 3;
  string country_code = 4;
  int32 min = 5;
  int32 max = 6;
}

message Series {
  string id = 1;
  string name = 2;
  string category = 3;
  string sub_category = 4;
  string genre = 5;
  string sub_genre = 6;
  string display_name = 7;
}

message Clip {
  string id = 1;
  string name = 2;
  Partner partner = 3;
  string description = 4;
  Author author = 5;
  repeated Thumbnail thumbnails = 6;
  string partner_code = 7;
  repeated Fragment fragments = 8;
  double in_point = 9;
  double out_point = 10;
  string language = 11;
  string rating_reason = 12;
  string genre = 13;
  string sub_genre = 14;
  string summary = 15;
  string category = 16;
  repeated ClipSource sources = 17;
  string rating = 18;
  float duration = 19;
  Nielsen nielsen = 20;
  HydratedComScore com_score = 21;
  string url = 22;
  string content_status = 23;
  double duration_float64 = 24;
  bool promotional = 25;
  repeated int32 breakpoints = 26;
}

message Nielsen {
  int32 duration = 1;
  string genre = 2;
  string name = 3;
}

message HydratedComScore {
  ComScoreStreamingTag streaming_tag = 1;
  ComScoreMetadata metadata = 2;
}

message ComScoreStreamingTag {
  string customer_c2 = 1;
}

message ComScoreMetadata {
  string c3 = 1;
  string c4 = 2;
  string c6 = 3;
  string ns_st_ce = 4;
  int32 ns_st_cl = 5;
  string ns_st_ddt = 6;
  string ns_st_ge = 7;
  string ns_st_ia = 8;
  string ns_st_pr = 9;
  string ns_st_tdt = 10;
  string ns_st_ti = 11;
  string ns_st_ci = 12;
}

message Partner {
  string id = 1;
  string name = 2;
}

message Fragment {
  repeated int32 breakpoints = 1;
  repeated SubClip sub_clips = 2;
}

message SubClip {
  string id = 1;
  int32 start_at = 2;
  string url = 3;
  float duration = 4;
  repeated ClipSource sources = 5;
  double duration_float64 = 6;
}

message Author {
  string name = 1;
}

message Thumbnail {
  string base_url = 1;
  string prefix = 2;
  int32 width = 3;
  int32 height = 4;
  string format = 5;
  int32 interval_in_frames = 6;
}

message Source {
  Clip clip = 1;
  int32 in_point = 2;
  int32 out_point = 3;
  repeated AdPod ad_pods = 4;
}

message ClipSource {
  string file = 1;
  string id = 2;
  string type = 3;
  string encryption = 4;
}

message AdPod {
  int32 start_at = 1;
  int32 duration = 2;
}
