syntax = "proto2";

package mecomp;

import "google/protobuf/duration.proto";


message RecordId {
  required string tb = 1;
	required string id = 2;
}

message Ulid {
  required string id = 1;
}

message RecordIdList {
  repeated RecordId ids = 1;
}

// Core data structures shared across MECOMP services.
message Song {
  required RecordId id = 1;
  required string title = 2;
  repeated string artists = 3;
  repeated string album_artists = 4;
  required string album = 5;
  repeated string genres = 6;
  required google.protobuf.Duration runtime = 7;
  optional uint32 track = 8;
  optional uint32 disc = 9;
  optional uint32 release_year = 10;
  required string extension = 11;
  required string path = 12;
}

message SongOption {
  optional Song song = 1;
}

message SongList {
  repeated Song songs = 1;
}

message SongListOption {
  optional SongList songs = 1;
}

message SongBrief {
  required RecordId id = 1;
  required string title = 2;
  repeated string artists = 3;
  repeated string album_artists = 4;
  required string album = 5;
  repeated string genres = 6;
  required google.protobuf.Duration runtime = 7;
  optional uint32 track = 8;
  optional uint32 disc = 9;
  optional uint32 release_year = 10;
  required string path = 12;
}

message SongBriefOption {
  optional SongBrief song = 1;
}

message SongBriefList {
  repeated SongBrief songs = 1;
}

message SongBriefListOption {
  optional SongBriefList songs = 1;
}

message Artist {
  required RecordId id = 1;
  required string name = 2;
  required google.protobuf.Duration runtime = 3;
  required uint64 album_count = 4;
  required uint64 song_count = 5;
}

message ArtistOption {
  optional Artist artist = 1;
}

message ArtistList {
  repeated Artist artists = 1;
}

message ArtistListOption {
  optional ArtistList artists = 1;
}

message ArtistBrief {
  required RecordId id = 1;
  required string name = 2;
}

message ArtistBriefOption {
  optional ArtistBrief artist = 1;
}

message ArtistBriefList {
  repeated ArtistBrief artists = 1;
}

message ArtistBriefListOption {
  optional ArtistBriefList artists = 1;
}

message Album {
  required RecordId id = 1;
  required string title = 2;
  repeated string artists = 3;
  optional uint32 release = 4;
  required google.protobuf.Duration runtime = 5;
  required uint64 song_count = 6;
  required uint32 discs = 7;
  repeated string genres = 8;
}

message AlbumOption {
  optional Album album = 1;
}

message AlbumList {
  repeated Album albums = 1;
}

message AlbumListOption {
  optional AlbumList albums = 1;
}

message AlbumBrief {
  required RecordId id = 1;
  required string title = 2;
  repeated string artists = 3;
  optional uint32 release = 4;
  required uint32 discs = 5;
  repeated string genres = 6;
}

message AlbumBriefOption {
  optional AlbumBrief album = 1;
}

message AlbumBriefList {
  repeated AlbumBrief albums = 1;
}

message AlbumBriefListOption {
  optional AlbumBriefList albums = 1;
}

message Playlist {
  required RecordId id = 1;
  required string name = 2;
  required google.protobuf.Duration runtime = 3;
  required uint64 song_count = 4;
}

message PlaylistOption {
  optional Playlist playlist = 1;
}

message PlaylistList {
  repeated Playlist playlists = 1;
}

message PlaylistListOption {
  optional PlaylistList playlists = 1;
}

message PlaylistBrief {
  required RecordId id = 1;
  required string name = 2;
}

message PlaylistBriefOption {
  optional PlaylistBrief playlist = 1;
}

message PlaylistBriefList {
  repeated PlaylistBrief playlists = 1;
}

message PlaylistBriefListOption {
  optional PlaylistBriefList playlists = 1;
}

message Collection {
  required RecordId id = 1;
  required string name = 2;
  required google.protobuf.Duration runtime = 3;
  required uint64 song_count = 4;
}

message CollectionOption {
  optional Collection collection = 1;
}

message CollectionList {
  repeated Collection collections = 1;
}

message CollectionListOption {
  optional CollectionList collections = 1;
}

message CollectionBrief {
  required RecordId id = 1;
  required string name = 2;
}

message CollectionBriefOption {
  optional CollectionBrief collection = 1;
}

message CollectionBriefList {
  repeated CollectionBrief collections = 1;
}

message CollectionBriefListOption {
  optional CollectionBriefList collections = 1;
}

message DynamicPlaylist {
  required RecordId id = 1;
  required string name = 2;
  required string query = 3;
}

message DynamicPlaylistOption {
  optional DynamicPlaylist playlist = 1;
}

message DynamicPlaylistList {
  repeated DynamicPlaylist playlists = 1;
}

message DynamicPlaylistListOption {
  optional DynamicPlaylistList playlists = 1;
}

message DynamicPlaylistChangeSet {
  optional string new_name = 1;
  optional string new_query = 2;
}
