// https://protobuf.dev/programming-guides/proto3
/*
python -m grpc_tools.protoc \
  --proto_path=./src/common/grpc/idl \
  --python_out=./src/common/grpc/idl \
  --pyi_out=./src/common/grpc/idl \
  --grpc_python_out=./src/common/grpc/idl \
  ./src/common/grpc/idl/tts.proto
*/

syntax = "proto3";

package chat_bot.tts;

message LoadModelRequest {
  string tts_tag = 1;
  bool is_reload = 2;
  string json_kwargs = 3;
}

message LoadModelResponse {}

message SynthesizeRequest {
  string tts_text = 1;
  string json_kwargs = 2;
}

message SynthesizeResponse { bytes tts_audio = 1; }

message GetVoicesRequest {}
message GetVoicesResponse { repeated string voices = 1; }

message SetVoiceRequest { string voice = 1; }
message SetVoiceResponse {}

message GetStreamInfoRequest {}
message GetStreamInfoReponse {
  int32 format = 1;
  int32 channels = 2;
  int32 rate = 3;
  int32 sample_width = 4;
}

service TTS {
  rpc LoadModel(LoadModelRequest) returns (LoadModelResponse) {}
  rpc GetVoices(GetVoicesRequest) returns (GetVoicesResponse) {}
  rpc SetVoice(SetVoiceRequest) returns (SetVoiceResponse) {}
  rpc GetStreamInfo(GetStreamInfoRequest) returns (GetStreamInfoReponse) {}
  rpc SynthesizeUS(SynthesizeRequest) returns (stream SynthesizeResponse) {}
}
