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

syntax = "proto3";

package channelcategorypackage;

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

service ChannelCategoryManager {
  // GetDocumentsUpdatedBetweenDates (Server Stream)
  //
  rpc GetDocumentsUpdatedBetweenDates(GetDocumentsUpdatedBetweenDatesRequest) returns (stream ChannelCategory) {}

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

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

  // GetById (Unary)
  //
  rpc GetById(GetByIdRequest) returns (GetByIdResponse) {}

  // UpdateFields (Unary)
  //
  rpc UpdateFields(UpdateFieldsRequest) returns (UpdateFieldsResponse) {}
}

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 ChannelCategory {
  string id = 1;
  string name = 2;
  int32 order = 3;
  Path svg_image_url = 4;
  Path png_image_url = 5;
  string created_at = 6;
  string updated_at = 7;

  message Path {
    string path = 1;
  }
}

message GetByIdRequest {
  string id = 1;
}

message GetByIdResponse {
  ChannelCategory document = 1;
}

message UpdateFieldsRequest {
  string id = 1;
  ChannelCategory document = 2;
  repeated string update_fields = 3;
}

message UpdateFieldsResponse {
  ChannelCategory document = 1;
}
