syntax = "proto3";

package music.v1alpha1;

import "metadata/v1alpha1/track.proto";
import "objects/v1alpha1/playlist.proto";

message CreateRequest {
  string name = 1;
  repeated metadata.v1alpha1.Track tracks = 2;
}

message CreateResponse {
  string id = 1;
  string name = 2;
  repeated metadata.v1alpha1.Track tracks = 3;
}

message DeleteRequest { string id = 1; }

message DeleteResponse {
  string id = 1;
  string name = 2;
}

message GetItemsRequest { string id = 1; }

message GetItemsResponse {
  string id = 1;
  string name = 2;
  repeated metadata.v1alpha1.Track tracks = 3;
}

message RenameRequest {
  string id = 1;
  string name = 2;
}

message RenameResponse {
  string id = 1;
  string name = 2;
}

message RemoveItemRequest {
  string id = 1;
  string track_id = 2;
}

message RemoveItemResponse {
  string id = 1;
  string name = 2;
  repeated metadata.v1alpha1.Track tracks = 3;
}

message AddItemRequest {
  string id = 1;
  string track_id = 2;
}

message AddItemResponse {
  string id = 1;
  string name = 2;
  repeated metadata.v1alpha1.Track tracks = 3;
}

message FindAllRequest {}

message FindAllResponse { repeated GetPlaylistDetailsResponse playlists = 1; }

message GetPlaylistDetailsRequest { string id = 1; }

message GetPlaylistDetailsResponse {
  string id = 1;
  string name = 2;
  string description = 3;
  repeated metadata.v1alpha1.Track tracks = 4;
}

message CreateFolderRequest {
  string name = 1;
}

message CreateFolderResponse {
  string id = 1;
  string name = 2;
}

message RenameFolderRequest {
  string id = 1;
  string name = 2;
}

message RenameFolderResponse {
  string id = 1;
  string name = 2;
}

message DeleteFolderRequest { string id = 1; }

message DeleteFolderResponse {
  string id = 1;
  string name = 2;
}

message FindAllFoldersRequest {}

message FindAllFoldersResponse {
  repeated GetFolderDetailsResponse folders = 1;
}

message GetFolderDetailsRequest { string id = 1; }

message GetFolderDetailsResponse {
  string id = 1;
  string name = 2;
  repeated objects.v1alpha1.Playlist playlists = 3;
}

service PlaylistService {
  rpc Create(CreateRequest) returns (CreateResponse) {}
  rpc Delete(DeleteRequest) returns (DeleteResponse) {}
  rpc GetItems(GetItemsRequest) returns (GetItemsResponse) {}
  rpc Rename(RenameRequest) returns (RenameResponse) {}
  rpc RemoveItem(RemoveItemRequest) returns (RemoveItemResponse) {}
  rpc AddItem(AddItemRequest) returns (AddItemResponse) {}
  rpc FindAll(FindAllRequest) returns (FindAllResponse) {}
  rpc GetPlaylistDetails(GetPlaylistDetailsRequest)
      returns (GetPlaylistDetailsResponse) {}
  rpc CreateFolder(CreateFolderRequest) returns (CreateFolderResponse) {}
  rpc DeleteFolder(DeleteFolderRequest) returns (DeleteFolderResponse) {}
  rpc RenameFolder(RenameFolderRequest) returns (RenameFolderResponse) {}
  rpc FindAllFolders(FindAllFoldersRequest) returns (FindAllFoldersResponse) {}
  rpc GetFolderDetails(GetFolderDetailsRequest)
      returns (GetFolderDetailsResponse) {}
}
