syntax = "proto3";
package code.justin.tv.safety.dmca;
option go_package = "dmca";

import "google/protobuf/timestamp.proto";

service DMCA {
  // AddUser gives a user access to the DMCA tool
  rpc AddUser (AddUserRequest) returns (AddUserResponse);
  // RemoveUser takes away access from the DMCA tool
  rpc RemoveUser (RemoveUserRequest) returns (RemoveUserResponse);
  // TakedownContent strikes content for DMCA and gives the owning user a strike
  rpc TakedownContent (TakedownContentRequest) returns (TakedownContentResponse);
  // CounterNotice issues a counter notice for a user, removes their strike and undoes their ban
  rpc CounterNotice (CounterNoticeRequest) returns (CounterNoticeResponse);
  // StruckContent gets the content struck for a given user
  rpc StruckContent (StruckContentRequest) returns (StruckContentResponse);
  // StruckBy gets the content struck by a given user
  rpc StruckBy (StruckByRequest) returns (StruckByResponse);
  // IsUserWhitelisted returns whether a user is whitelisted by DMCA for access
  rpc IsUserAuthorized (IsUserAuthorizedRequest) returns (IsUserAuthorizedResponse);
  // GetUser returns the user data for a given user
  rpc GetUser (GetUserRequest) returns (GetUserResponse);
}


message AddUserRequest {
  string UserID = 1;
  string CompanyName = 2;
  string PhoneNumber = 3;
  string Address = 4;
  string Email = 5;
}

message AddUserResponse {
  bool Success = 1;
}

message RemoveUserRequest {
  string UserID = 1;
}


message RemoveUserResponse {
  bool Success = 1;
}

enum MediaType {
  CLIP = 0;
  VOD = 1;
  STREAM = 2;
}


message GetUserRequest {
  string UserID = 1;
}

message GetUserResponse {
  string UserID = 1;
  string CompanyName = 2;
  string PhoneNumber = 3;
  string Address = 4;
  string Email = 5;
}

message TakedownContentRequest {
  string IssuerID = 1;
  map<string, MediaType> Content = 2;
  string CompanyName = 3;
  string PhoneNumber = 4;
  string Address = 5;
  string Email = 6;
  string Claimant = 7;
}

message TakedownContentResponse {
  map<string, MediaType> Content = 1;
}


message CounterNoticeRequest {
  string IssuerID = 1;
}

message CounterNoticeResponse {
  map<string, MediaType> ReactivatedContent = 1;
}

message StruckContentRequest {
  string OwnerID = 1;
  google.protobuf.Timestamp WindowStart = 2;
  google.protobuf.Timestamp WindowEnd = 3;
}

message RightsHolderContent {
  map<string, MediaType> StruckContent = 1;
}

message StruckContentResponse {
  repeated Content StruckContent = 1;
}

message StruckByRequest {
  string IssuerID = 1;
  google.protobuf.Timestamp WindowStart = 2;
  google.protobuf.Timestamp WindowEnd = 3;
}


message Content {
  string NoticeID = 1;
  string ContentID = 2;
  string IssuerID = 3;
  string URL = 4;
  google.protobuf.Timestamp IssueTime = 5;
  MediaType ContentType = 6;
  string Title = 7;
}
message StruckByResponse {
  repeated Content StruckContent = 1;
}


message IsUserAuthorizedRequest {
  string UserID = 1;
}

message IsUserAuthorizedResponse {
  bool OK = 1;
  bool Has2FA = 2;
  bool HasVerifiedEmail = 3;
  bool IsWhitelisted = 4;
}