syntax = "proto3";

package receiver.v1;

option go_package = "spektr/internal/grpc/pb;pb";


// =========================
// Service (один stream)
// =========================

service ReceiverService {
  rpc Connect(stream ClientMessage) returns (stream ServerMessage);
}


// =========================
// Client -> Daemon
// =========================

message ClientMessage {
  string request_id = 1;

  oneof payload {
    AvCommand av = 10;
    SetFrequencyCommand set_frequency = 11;
    GetFrequencyCommand get_frequency = 12;
  }
}


// =========================
// Server -> Client
// =========================

message ServerMessage {
  string request_id = 1;

  oneof payload {
    AvResponse av = 10;
    SetFrequencyResponse set_frequency = 11;
    GetFrequencyResponse get_frequency = 12;

    Error error = 50;
  }
}


// =========================
// Commands
// =========================

message AvCommand {}

message SetFrequencyCommand {
  uint32 frequency = 1;
}

message GetFrequencyCommand {}


// =========================
// Responses
// =========================

message AvResponse {
  bool ok = 1;
  string hw = 2;
  string sw = 3;
}

message SetFrequencyResponse {
  bool ok = 1;
}

message GetFrequencyResponse {
  uint32 frequency = 1;
}


// =========================
// Error
// =========================

message Error {
  string message = 1;
}