// Copyright 2024 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
syntax = "proto3";

package state_manager;

import "pw_protobuf_protos/common.proto";

service StateManager {
  rpc ChangeThreshold(ChangeThresholdRequest) returns (pw.protobuf.Empty);
  rpc SilenceAlarm(pw.protobuf.Empty) returns (pw.protobuf.Empty);
  rpc GetState(pw.protobuf.Empty) returns (State);
}

message ChangeThresholdRequest {
  // If true, increments the alarm threshold to its next step.
  // If false, decrements.
  bool increment = 1;
}

message State {
  bool alarm_active = 1;
  uint32 alarm_threshold = 2;
  uint32 aq_score = 3;
  string aq_description = 4;
}