/*
 * Created by jonathan.jesperson@pluto.tv on 01/22/2021.
 * Copyright (c) PlutoTV Inc 2021.
 */

syntax = "proto3";

package labpartnerpackage;

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

service LabPartnerManager {
  // GetLabPartnerObjectByEpisodeIds (Unary)
  //
  rpc GetLabPartnerObjectByEpisodeIds(GetLabPartnerObjectByEpisodeIdsRequest) returns (GetLabPartnerObjectByEpisodeIdsResponse) {}
}

message GetLabPartnerObjectByEpisodeIdsRequest {
  repeated string episode_ids = 1;
}

message GetLabPartnerObjectByEpisodeIdsResponse {
  string type = 1;
  Series series = 2;
}

message Series {
  string id = 1;
  string updated_at = 2;
  string created_at = 3;
  string name = 4;
  bool published = 5;
  string display_name = 6;
  string slug = 7;
  repeated Episode episodes = 8;
  repeated Season seasons = 9;
  repeated string channels = 10;
  string type = 11;
  string category = 12;
  string sub_category = 13;
  string genre = 14;
  string sub_genre = 15;
  repeated string tags = 16;
  string summary = 17;
  string description = 18;
  string notes = 19;
  Image thumbnail = 20;
  Image featured_image = 21;
  Image partner_logo = 22;
  Image poster = 23;
  Image tile = 24;
  int32 episode_count = 25;
  int32 season_count = 26;
  bool user_generated = 27;
  DistributeAs distribute_as = 28;
  repeated string vod_category_entries = 29;
  bool pluto_tv_o_o = 30;
  string tmsid = 31;
  string active_region = 32; // not in schema
  string metadata_language = 33; // not in schema
  repeated string region_filter = 34; // not in schema
  string rating = 35; // not in schema
  AvailabilityWindows availability_windows = 36; // not in schema
  string available_date = 37; // not in schema
  string expiration_date = 38; // not in schema
  bool expiration_set_manually = 39; // not in schema
  string content_u_u_i_d = 40;
  string _e_i_d_r_series = 41 [json_name = "EIDRSeries"];
  repeated RatingDescriptor rating_descriptors = 42;
}

message AvailabilityWindows {
  repeated Window _a_v_o_d = 1 [json_name = "AVOD"];
  repeated Window linear = 2;
}

message Window {
  string start_date = 1;
  string end_date = 2;
  string id = 3;
  int32 current_screenings = 4;
  int32 screenings = 5;
}

message Season {
  int32 number = 1;
  string synopsis = 2;
}

message Image {
  string path = 1;
  string title = 2;
}

message DistributeAs {
  bool _t_v_o_d = 1 [json_name = "TVOD"];
  bool _a_v_o_d = 2 [json_name = "AVOD"];
  bool _s_v_o_d = 3 [json_name = "SVOD"];
  bool linear = 4;
}

message Episode {
  string id = 1;
  string created_at = 2;
  string updated_at = 3;
  string name = 4;
  string display_name = 5;
  string display_on_guide = 6;
  repeated Clip clips = 7;
  bool ad_free = 8;
  bool ad_pods_verified = 9;
  string author = 10;
  string slug = 11;
  string uid = 12;
  int32 number = 13;
  string series = 14;
  int32 season = 15;
  int32 duration = 16;
  int32 allotment = 17;
  int32 ad_pods_duration = 18;
  string description = 19;
  string summary = 20;
  string notes = 21;
  string category = 22;
  string sub_category = 23;
  string genre = 24;
  string sub_genre = 25;
  repeated string tags = 26;
  bool published = 27;
  string status = 28;
  bool live_broadcast = 29;
  string premiere = 30;
  string first_aired = 31;
  string last_aired = 32;
  NextTimeline next_timeline = 33;
  bool derivative = 34;
  bool is_feed = 35;
  repeated string feeds = 36;
  bool featured = 37;
  string parent = 38;
  repeated Content content = 39;
  repeated Source sources = 40;
  repeated Backups backups = 41;
  repeated string channels = 42;
  Image thumbnail = 43;
  Image featured_image = 44;
  Image partner_logo = 45;
  Image poster = 46;
  Image screenshot16_9 = 47 [json_name = "screenshot16_9"];
  Image screenshot4_3 = 48 [json_name = "screenshot4_3"];
  Meta meta = 49;
  bool flagged = 50;
  DistributeAs distribute_as = 51;
  PlaybackRestrictions playback_restrictions = 52;
  repeated string vod_category_entries = 53;
  bool pluto_tv_o_o = 54;
  string tmsid = 55;
  string active_region = 56; // not in schema
  AvailabilityWindows availability_windows = 57; // not in schema
  string metadata_language = 58; // not in schema
  string rating = 59; // not in schema
  repeated string region_filter = 60;
  bool dash_enabled = 61;
  repeated AgeRange age_range = 62;
  string content_u_u_i_d = 63;
  string _e_i_d_r = 64 [json_name = "EIDR"];
  repeated RatingDescriptor rating_descriptors = 65;
}

message RatingDescriptor {
  string id = 1;
  string display_name = 2;
  string label = 3;
  string region = 4;
  string slug = 5;
  string created_at = 6;
  string updated_at = 7;
}

message NextTimeline {
  string id = 1;
  string channel = 2;
  string start = 3;
}

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

message Source {
  string clip = 1;
  int32 in_point = 2;
  int32 out_point = 3;
  repeated AdPod ad_pods = 4;
  repeated AlternativeAdPods alternative_ad_pods = 5;
}

message Backups {
  string clip = 1;
  int32 in_point = 2;
  int32 out_point = 3;
}

message Meta {
  int32 views = 1;
}

message PlaybackRestrictions {
  Restriction _v_o_d = 1 [json_name = "VOD"];
  Restriction linear = 2;
}

message Restriction {
  bool start_over = 1;
  bool pause = 2;
  bool fast_forward = 3;
  bool rewind = 4;
}

message AdPod {
  int32 start_at = 1;
  int32 duration = 2;
  string pod_type = 3;
  bool partner_provided = 4;
  repeated string tags = 5;
  bool duration_locked = 6;
  bool verified = 7;
}

message AlternativeAdPods {
  string name = 1;
  repeated AdPod ad_pods = 2;
}
message Clip {
  reserved 54 to 56; // framerate attrs originally had int32 and need to be double. No services are using 54-56 yet, can reserve.
  string id = 1;
  string name = 2;
  string partner = 3;
  string description = 4;
  Author author = 5;
  Advertising advertising = 6;
  Image featured_image = 7;
  string thumbnail = 8;
  repeated Thumbnail thumbnails = 9;
  string pluto_avails_i_d = 10;
  bool published = 11;
  bool live_broadcast = 12;
  bool promotional = 13;
  string provider = 14;
  string code = 15;
  string partner_code = 16;
  string internal_code = 17;
  string md5 = 18;
  string url = 19;
  repeated Fragment fragments = 20;
  double in_point = 21;
  double out_point = 22;
  string type = 23;
  repeated string tags = 24;
  int32 score = 25;
  int32 votes = 26;
  string uploaded = 27;
  string updated = 28;
  Meta meta = 29;
  bool flagged = 30;
  bool captions_required = 31;
  string captioned = 32;
  repeated Cc cc = 33;
  string copyright = 34;
  string language = 35;
  string rating_reason = 36;
  string original_release_date = 37;
  string genre = 38;
  string sub_genre = 39;
  string summary = 40;
  repeated Cc subtitles = 41;
  repeated string directors = 42;
  repeated string actors = 43;
  repeated string writers = 44;
  repeated string producers = 45;
  repeated int32 breakpoints = 46 [packed = true];
  repeated string breakpoints_s_m_p_t_e = 47;
  repeated string breakpoints_ingestion = 48;
  DistributeAs distribute_as = 49;
  string programming_type = 50;
  string color = 51;
  string category = 52;
  string ad_sparx_stream_id = 53;

  string tmsid = 57;
  string created_at = 58;
  string updated_at = 59;
  repeated Source sources = 60;
  string rating = 61;
  double duration = 62;
  Origin origin = 63;
  string active_region = 64;

  string content_status = 65; // not found in inf-lib-schemas
  repeated string region_filter = 66; // not found in inf-lib-schemas
  AvailabilityWindows availability_windows = 67; // not found in inf-lib-schemas
  string encoding_profile = 68; // not found in inf-lib-schemas
  string content_u_u_i_d = 69; // not found in inf-lib-schemas
  repeated RatingDescriptor rating_descriptors = 70; // not found in inf-lib-schemas

  // work around for migrating attributes originally created with the incorrect datatype
  // ARCH-2221: validate framerate, ffprobeFramerate, feedFramerate is Double
  double framerate = 71;
  // work around for migrating attributes originally created with the incorrect datatype
  // ARCH-2221: validate framerate, ffprobeFramerate, feedFramerate is Double
  double ffprobe_framerate = 72;
  // work around for migrating attributes originally created with the incorrect datatype
  // ARCH-2221: validate framerate, ffprobeFramerate, feedFramerate is Double
  double feed_framerate = 73;

  repeated Markup markups = 74;
  repeated TimedText timed_text = 75;
  repeated string production_company = 76;
  repeated string production_countries = 77;
  int32 production_year = 78;
}

message TimedText {
  string id = 1;
  string type = 2;
  string language = 3;
  string updated_at = 4;
}

message Markup {
  string id = 1;
  string type = 2;
  int32 start = 3;
  int32 end = 4;
}

message Author {
  string id = 1;
  string name = 2;
  string url = 3;
}

message Advertising {
  string client = 1;
  repeated Schedule schedule = 2;
}

message Schedule {
  string offset = 1;
  string tag = 2;
  string type = 3;
}

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

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

message Cc {
  string uri = 1;
  string language = 2;
  bool added_to_video = 3;
  string updated_at = 4;
  string id = 5;
}

message Origin {
  string url = 1;
  string src_url = 2;
  string type = 3; /// options: 'MP4', 'WebM', 'FLV', 'HLS', 'DASH', 'RTMP', 'MOV', 'video/mp4', 'video/webm', 'video/x-flv', 'application/x-mpegURL', 'application/octet-stream', 'video/mpeg', 'video/quicktime', 'video/x-msvideo', 'video/x-ms-wmv', 'binary/octet-stream',
  int32 in_point = 4; /// Used to crop video, in seconds
  int32 out_point = 5; /// Used to crop video, in seconds
  int32 bitrate = 6; /// Bitrate in kbps
  int32 duration = 7; /// Seconds
  int32 height = 8;
  int32 width = 9;
  optional int32 size = 10; /// Optional. Size in bytes,
  optional string md5 = 11; /// Optional, 32-character MD5 digest of video
  bool generatingFile = 12; /// Used to flag when the origin file is being generated by the worker-hls-to-mp4
}

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