syntax = "proto3";

package health;

option go_package = "github.com/talos-systems/talos/pkg/machinery/api/health";

import "google/protobuf/empty.proto";

service Health {
  rpc Check(google.protobuf.Empty) returns (HealthCheckResponse);
  rpc Watch(HealthWatchRequest)  returns (stream HealthCheckResponse);
  rpc Ready(google.protobuf.Empty) returns (ReadyCheckResponse);
}

message HealthWatchRequest {
  int64 interval_seconds = 1;
}

message HealthCheck {
  enum ServingStatus {
    UNKNOWN = 0;
    SERVING = 1;
    NOT_SERVING = 2;
  }
  ServingStatus status = 1;
}

message HealthCheckResponse {
  repeated HealthCheck messages = 1;
}

message ReadyCheck {
  enum ReadyStatus {
    UNKNOWN = 0;
    READY = 1;
    NOT_READY = 2;
  }
  ReadyStatus status = 1;
}

message ReadyCheckResponse {
  repeated ReadyCheck messages = 1;
}
