package spotify.metadata.proto;

option optimize_for = SPEED;
option java_package = "com.spotify.metadata.proto";
option java_outer_classname = "Metadata";

message TopTracks {
  optional string country = 1;
  repeated Track track = 2;
}
message ActivityPeriod {
  optional sint32 start_year = 1;
  optional sint32 end_year = 2;
  optional sint32 decade = 3;
}
message Artist {
  optional bytes gid = 1;
  optional string name = 2;
  optional sint32 popularity = 3;
  repeated TopTracks top_track = 4;
  repeated AlbumGroup album_group = 5;
  repeated AlbumGroup single_group = 6;
  repeated AlbumGroup compilation_group = 7;
  repeated AlbumGroup appears_on_group = 8;
  repeated string genre = 9;
  repeated ExternalId external_id = 10;
  repeated Image portrait = 11;
  repeated Biography biography = 12;
  repeated ActivityPeriod activity_period = 13;
  repeated Restriction restriction = 14;
  repeated Artist related = 15;
  optional bool is_portrait_album_cover = 16;
  optional ImageGroup portrait_group = 17;
}
message AlbumGroup {
  repeated Album album = 1;
}
message Date {
  optional sint32 year = 1;
  optional sint32 month = 2;
  optional sint32 day = 3;
}
message Album {
  enum Type {
    ALBUM = 1;
    SINGLE = 2;
    COMPILATION = 3;
  }
  optional bytes gid = 1;
  optional string name = 2;
  repeated Artist artist = 3;
  optional Type type = 4;
  optional string label = 5;
  optional Date date = 6;
  optional sint32 popularity = 7;
  repeated string genre = 8;
  repeated Image cover = 9;
  repeated ExternalId external_id = 10;
  repeated Disc disc = 11;
  repeated string review = 12;
  repeated Copyright copyright = 13;
  repeated Restriction restriction = 14;
  repeated Album related = 15;
  repeated SalePeriod sale_period  = 16;
  optional ImageGroup cover_group  = 17;
}

message Track {
  optional bytes gid = 1;
  optional string name = 2;
  optional Album album = 3;
  repeated Artist artist = 4;
  optional sint32 number = 5;
  optional sint32 disc_number = 6;
  optional sint32 duration = 7;
  optional sint32 popularity = 8;
  optional bool explicit = 9;
  repeated ExternalId external_id = 10;
  repeated Restriction restriction = 11;
  repeated AudioFile file = 12;
  repeated Track alternative = 13;
  repeated SalePeriod sale_period = 14;
  repeated AudioFile preview = 15;
}
message Image {
  enum Size {
    DEFAULT = 0;
    SMALL = 1;
    LARGE = 2;
    XLARGE = 3;
  }
  optional bytes file_id = 1;
  optional Size size = 2;
  optional sint32 width = 3;
  optional sint32 height = 4;
}
message ImageGroup {
  repeated Image image = 1;
}
message Biography {
  optional string text = 1;
  repeated Image portrait = 2;
  repeated ImageGroup portrait_group = 3;
}
message Disc {
  optional sint32 number = 1;
  optional string name = 2;
  repeated Track track = 3;
}
message Copyright {
  enum Type {
    P = 0;
    C = 1;
  }
  optional Type type = 1;
  optional string text = 2;
}
message Restriction {
  enum Catalogue {
    AD = 0;
    SUBSCRIPTION = 1;
    SHUFFLE = 3;
  }
  enum Type {
    STREAMING = 0;
  }
  repeated Catalogue catalogue = 1;
  optional string countries_allowed = 2;
  optional string countries_forbidden = 3;
  optional Type type = 4;
}

message SalePeriod {
  repeated Restriction restriction = 1;
  optional Date start = 2;
  optional Date end = 3;
}

message ExternalId {
  optional string type = 1;
  optional string id = 2;
}

message AudioFile {
  enum Format {
    OGG_VORBIS_96 = 0;
    OGG_VORBIS_160 = 1;
    OGG_VORBIS_320 = 2;
    MP3_256 = 3;
    MP3_320 = 4;
    MP3_160 = 5;
    MP3_96 = 6;
  }
  optional bytes file_id = 1;
  optional Format format = 2;
}
