syntax = "proto3";

package music;

option go_package = "github.com/echofi-ai/backend/types/music";

import "music/artist.proto";
import "music/album.proto";
import "music/track.proto";
import "music/genre.proto";

// MusicService defines the gRPC service for music operations
service MusicService {
  // GetArtist retrieves an artist by ID
  rpc GetArtist(GetArtistRequest) returns (GetArtistResponse) {}
  
  // ListArtists retrieves artists with pagination
  rpc ListArtists(ListArtistsRequest) returns (ListArtistsResponse) {}
  
  // GetAlbum retrieves an album by ID
  rpc GetAlbum(GetAlbumRequest) returns (GetAlbumResponse) {}
  
  // ListAlbums retrieves albums with pagination
  rpc ListAlbums(ListAlbumsRequest) returns (ListAlbumsResponse) {}
  
  // GetTrack retrieves a track by ID
  rpc GetTrack(GetTrackRequest) returns (GetTrackResponse) {}
  
  // ListTracks retrieves tracks with pagination
  rpc ListTracks(ListTracksRequest) returns (ListTracksResponse) {}
  
  // GetGenre retrieves a genre by ID
  rpc GetGenre(GetGenreRequest) returns (GetGenreResponse) {}
  
  // ListGenres retrieves genres with pagination
  rpc ListGenres(ListGenresRequest) returns (ListGenresResponse) {}
}

// Artist requests and responses
message GetArtistRequest {
  int32 artist_id = 1;
}

message GetArtistResponse {
  Artist artist = 1;
}

message ListArtistsRequest {
  int32 offset = 1;
  int32 limit = 2;
}

message ListArtistsResponse {
  repeated Artist artists = 1;
  int64 total = 2;
  int32 offset = 3;
  int32 limit = 4;
}

// Album requests and responses
message GetAlbumRequest {
  int32 album_id = 1;
}

message GetAlbumResponse {
  Album album = 1;
}

message ListAlbumsRequest {
  int32 offset = 1;
  int32 limit = 2;
  optional int32 artist_id = 3; // Filter by artist
}

message ListAlbumsResponse {
  repeated Album albums = 1;
  int64 total = 2;
  int32 offset = 3;
  int32 limit = 4;
}

// Track requests and responses
message GetTrackRequest {
  int32 track_id = 1;
}

message GetTrackResponse {
  Track track = 1;
}

message ListTracksRequest {
  int32 offset = 1;
  int32 limit = 2;
  optional int32 artist_id = 3; // Filter by artist
  optional int32 album_id = 4;  // Filter by album
  optional int32 genre_id = 5;  // Filter by genre
}

message ListTracksResponse {
  repeated Track tracks = 1;
  int64 total = 2;
  int32 offset = 3;
  int32 limit = 4;
}

// Genre requests and responses
message GetGenreRequest {
  int32 genre_id = 1;
}

message GetGenreResponse {
  Genre genre = 1;
}

message ListGenresRequest {
  int32 offset = 1;
  int32 limit = 2;
}

message ListGenresResponse {
  repeated Genre genres = 1;
  int64 total = 2;
  int32 offset = 3;
  int32 limit = 4;
}
