syntax = "proto3";

package commercial;

option go_package = "commercial";

import "eventbus/owner.proto";

// CommercialUpdate indicates the status change of an ad request.
// It is triggered when GoTranscode confirms whether or not an ad
// was successfully injected into the stream as an ID3 tag or when
// a timeout occurs.
message CommercialUpdate {
  option (eventbus.owner.ldap_group) = "team-ads";
  // The ID of the commercial.
  string id = 1;
  // The type of requested commercial.
  CommercialType type = 2;
  // The user/channel ID of the broadcaster.
  string user_id = 3;
  // The duration of the requested commercial in seconds.
  int32 duration = 4;
  // The ID of the user that requested the commercial.
  string requester_user_id = 5;
  // The status of the commercial request.
  CommercialStatus status = 6;
}

// The different types of possible commercial formats.
enum CommercialType {
  // An unknown or invalid ad format.
  COMMERCIAL_TYPE_INVALID = 0;
  // The standard ad format.
  COMMERCIAL_TYPE_STANDARD = 1;
  // The Picture-By-Picture ad format.
  COMMERCIAL_TYPE_PICTURE_BY_PICTURE = 2;
  // Auto-ad played in the standard ad format.
  COMMERCIAL_TYPE_AUTO_STANDARD = 3;
  // Auto-ad played in the Picture-By-Picture ad format.
  COMMERCIAL_TYPE_AUTO_PICTURE_BY_PICTURE = 4;
}

// The different commercial status types that can be returned.
enum CommercialStatus {
  // Indicates an unknown or invalid failure.
  COMMERCIAL_STATUS_INVALID = 0;
  // Indicates a commercial was successfully injected into the stream.
  COMMERCIAL_STATUS_SUCCESS = 1;
  // Indicates a timeout occurred.
  COMMERCIAL_STATUS_TIMEOUT = 2;
  // Indicates a commercial was not successfully injected into the stream.
  COMMERCIAL_STATUS_INJECTION_FAILED = 3;
}
