syntax = "proto3";

package studio_api_grpc;

option go_package = "./gen/studio_api_grpc";

service StudioApiGrpcService {
  // Client streaming RPC
  rpc GenerateClientStream (stream GenerateRequest) returns (GenerateResponse);

  // Server streaming RPC
  rpc GenerateClipServerStream (GenerateServerStreamRequest) returns (stream GenerateServerStreamResponse);

  // Bidirectional streaming RPC
  rpc GenerateBidirectionalStream (stream GenerateRequest) returns (stream GenerateResponse);

  // Normal non-streaming RPC
  rpc Generate (GenerateRequest) returns (GenerateResponse);
  
  // Health check RPC
  rpc CheckHealth (HealthCheckRequest) returns (HealthCheckResponse);
}

message GenerateRequest {
  string name = 1;
}

message GenerateResponse {
  string message = 1;
}

message HealthCheckRequest {}

message HealthCheckResponse {
  bool healthy = 1;
}

message GenerateServerStreamRequest {
  string prompt = 1;
  optional string tags = 2;
  optional string negative_tags = 3;
  optional string title = 4;
  optional string gpt_prompt = 5;
  string gpt_description_prompt = 6;
  optional string voice_id = 7;
  optional string voice = 8;
  map<string, string> metadata = 9;
  optional string model_name = 10;
  optional bool stream = 11;
  optional bool is_regenerate = 12;
  optional int32 batch_size = 13;
  optional bool make_instrumental = 14;
  optional string cover_image_s3_id = 15;
  optional string creation_source = 16;
  optional string continue_clip_id = 17;
  optional int32 continue_at = 18;
  optional string continued_aligned_prompt = 19;
  string mv = 20;
  optional int32 infill_start_s = 21;
  optional int32 infill_end_s = 22;
  optional int32 infill_dur_s = 23;
  optional bool include_history = 24;
  string generation_type = 25;
  repeated string user_uploaded_images_b64 = 26;
  repeated string user_uploaded_images_ids = 27;
  optional string user_uploaded_video_id = 28;
  optional string artist_clip_id = 31;
  optional int32 artist_start_s = 32;
  optional int32 artist_end_s = 33;
  optional string cover_clip_id = 34;
  optional string persona_id = 35;
  optional string task = 36;
  optional string edit_session_id = 37;
}

message GenerateServerStreamResponse {
  optional string id = 1;
  repeated Clip clips = 2;
  optional Metadata metadata = 3;
  optional string major_model_version = 4;
  optional string status = 5;
  optional string created_at = 6;
  optional int32 batch_size = 7;
  optional string message = 8;
}

message Clip {
  optional string id = 1;
  optional string video_url = 2;
  optional string audio_url = 3;
  optional string image_url = 4;
  optional string image_large_url = 5;
  optional bool is_video_pending = 6;
  optional string major_model_version = 7;
  optional string model_name = 8;
  optional Metadata metadata = 9;
  optional bool is_liked = 10;
  optional string user_id = 11;
  optional string display_name = 12;
  optional string handle = 13;
  optional bool is_handle_updated = 14;
  optional string avatar_image_url = 15;
  optional bool is_trashed = 16;
  optional Reaction reaction = 17;
  optional string created_at = 18;
  optional string status = 19;
  optional string title = 20;
  optional int32 play_count = 21;
  optional int32 upvote_count = 22;
  optional bool is_public = 23;
}

message Metadata {
  optional string tags = 1;
  optional string negative_tags = 2;
  optional string prompt = 3;
  optional string gpt_description_prompt = 4;
  repeated HistoryItem history = 5;
  repeated HistoryItem concat_history = 6;
  optional string stem_from_id = 7;
  optional string type = 8;
  optional double duration = 9;
  optional bool refund_credits = 10;
  optional bool stream = 11;
  optional bool infill = 12;
  optional bool has_vocal = 13;
  optional bool is_audio_upload_tos_accepted = 14;
  optional string error_type = 15;
  optional string error_message = 16;
  map<string, int32> configurations = 17;
  optional string artist_clip_id = 18;
  optional string cover_clip_id = 19;
  optional string persona_id = 20;
  optional string video_to_song_video_upload_id = 21;
  optional string video_to_song_video_upload_url = 22;
  optional string video_to_song_video_output_url = 23;
  repeated string image_to_song_image_ids = 24;
  repeated string image_to_song_image_urls = 25;
  optional bool is_image_to_song = 26;
  optional bool is_suno_short = 27;
  optional string task = 28;
  optional string edit_session_id = 29;
}

message HistoryItem {
  optional string id = 1;
  optional double continue_at = 2;
  optional string type = 3;
  optional string source = 4;
  optional bool infill = 5;
}

message Reaction {
  optional int32 play_count = 1;
  optional int32 skip_count = 2;
  optional bool flagged = 3;
  optional string flagged_reason = 4;
  optional string feedback_reason = 5;
  optional string reaction_type = 6;
  optional string clip = 7;
  optional string updated_at = 8;
}