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

syntax = "proto3";

package vodpackage;

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

service VodManager {
  // GetActiveVodCategoryIds (Unary)
  //
  rpc GetActiveVodCategoryIds(GetActiveVodCategoryIdsRequest) returns (GetActiveVodCategoryIdsResponse) {}

  // GetActiveEpisodesForCategoryId (Unary)
  //
  rpc GetActiveEpisodesForCategoryId(GetActiveEpisodesForCategoryIdRequest) returns (GetActiveEpisodesForCategoryIdResponse) {}

  // GetActiveEpisodeIdsForCategoryId (Unary)
  //
  rpc GetActiveEpisodeIdsForCategoryId(GetActiveEpisodeIdsForCategoryIdRequest) returns (GetActiveEpisodeIdsForCategoryIdResponse) {}

  // GetDocumentsUpdatedBetweenDates (Server Stream)
  //
  rpc GetDocumentsUpdatedBetweenDates(GetDocumentsUpdatedBetweenDatesRequest) returns (stream VodCategory) {}

  // CFeedsSyncDocuments (Server Stream)
  //
  rpc CFeedsSyncDocuments(CFeedsSyncDocumentsRequest) returns (stream VodCategory) {}

  // CFeedsSyncAllIds (Server Stream)
  //
  rpc CFeedsSyncAllIds(CFeedsSyncAllIdsRequest) returns (stream Id) {}

  rpc BulkDeviceUpdate(BulkDeviceUpdateRequest) returns (BulkDeviceUpdateResponse) {}
}

message CFeedsSyncAllIdsRequest {}

message Id {
  string id = 1;
}

message CFeedsSyncDocumentsRequest {
  // Expressed as a valid javascript Date, https://en.wikipedia.org/wiki/ISO_8601
  string last_run_at = 1;
}

message GetDocumentsUpdatedBetweenDatesRequest {
  // Expressed as a valid javascript Date, https://en.wikipedia.org/wiki/ISO_8601
  string updated_at_min = 1;
  // Expressed as a valid javascript Date, https://en.wikipedia.org/wiki/ISO_8601
  string updated_at_max = 2;
}

message GetActiveVodCategoryIdsRequest {
  string active_region = 1;
}

message GetActiveVodCategoryIdsResponse {
  repeated string ids = 1;
}

message GetActiveEpisodeIdsForCategoryIdRequest {
  string id = 1;
}

message GetActiveEpisodeIdsForCategoryIdResponse {
  repeated string ids = 1;
}

message GetActiveEpisodesForCategoryIdRequest {
  string id = 1;
}

message GetActiveEpisodesForCategoryIdResponse {
  repeated ActiveEpisodeForACS episodes = 1;
}

message ActiveEpisodeForACS {
  string id = 1;
  string updated_at = 2;
  repeated ClipForActiveEpisodeForACS clips = 3;
}

message ClipForActiveEpisodeForACS {
  string id = 1;
  string updated_at = 2;
}

message VodCategory {
  string id = 1;
  string name = 2;
  string display_name = 3;
  int32 order = 4;
  bool enabled = 5;
  bool pluto_office_only = 6;
  string enabled_at = 7;
  string description = 8;
  RegionFilter region_filter = 9;
  RegionFilter distribution = 10;
  string intile_channel = 11;
  int32 intile_order = 12;
  Path icon_svg = 13;
  Path icon_png = 14;
  Path image_featured = 15;
  string created_at = 16;
  string updated_at = 17;
  string disabled_at = 18;
  string active_region = 19;
  bool kids_mode = 20;
  repeated Category categories = 21;
  repeated CustomReference custom_references = 22;
  bool archived = 23;
  bool hero_carousel = 24;

  message Path {
    string path = 1;
  }

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

message Category {
  string id = 1;
  string cat_id = 2;
  int32 order = 3;
}

message CustomReference {
  string id = 1;
  string type = 2;
  string value = 3;
}

message BulkDeviceUpdateRequest {
  repeated string devices = 1;
  repeated string include_group = 2;
  repeated string exclude_group = 3;
  repeated string remove_group = 4;
}

message BulkDeviceUpdateResponse {}
