syntax = "proto3";

package vemmiopb;

import "vemmio_client/metadata.proto";

option go_package = "./vemmiopb";
option java_multiple_files = true;
option java_package = "com.vemmio.ha.integration.vemmio.rpc.vemmiopb";

service Configuration {
  rpc ConfigurationList(ConfigurationListRequest) returns (ConfigurationListResponse);
  rpc ConfigurationGet(ConfigurationGetRequest) returns (ConfigurationGetResponse);
  rpc ConfigurationSet(ConfigurationSetRequest) returns (ConfigurationSetResponse);
}

message ConfigurationListRequest {
  DeviceMetadata metadata = 1;
}

message ConfigurationListResponse {
  repeated ConfigurationOption options = 1;
}

message ConfigurationGetRequest {
  DeviceMetadata metadata = 1;
  int32 index = 2;
}

message ConfigurationGetResponse {
  ConfigurationValue value = 1;
}

message ConfigurationSetRequest {
  DeviceMetadata metadata = 1;
  int32 index = 2;
  ConfigurationValue value = 3;
}

message ConfigurationSetResponse {}

message ConfigurationOption {
  int32 index = 1;
  string label = 2;
  string help = 3;
  ConfigurationValueType type = 4;
}

enum ConfigurationValueType {
  CONFIGURATION_VALUE_TYPE_UNDEFINED = 0;
  CONFIGURATION_VALUE_TYPE_BOOL = 1;
  CONFIGURATION_VALUE_TYPE_UINT8 = 2;
  CONFIGURATION_VALUE_TYPE_UINT16 = 3;
  CONFIGURATION_VALUE_TYPE_UINT32 = 4;
  CONFIGURATION_VALUE_TYPE_UINT64 = 5;
  CONFIGURATION_VALUE_TYPE_INT8 = 6;
  CONFIGURATION_VALUE_TYPE_INT16 = 7;
  CONFIGURATION_VALUE_TYPE_INT32 = 8;
  CONFIGURATION_VALUE_TYPE_INT64 = 9;
  CONFIGURATION_VALUE_TYPE_FLOAT32 = 10;
  CONFIGURATION_VALUE_TYPE_FLOAT64 = 11;
  CONFIGURATION_VALUE_TYPE_STRING = 12;
}

message ConfigurationValue {
  oneof value {
    ConfigurationValueScalar scalar = 1;
  }
}

message ConfigurationValueScalar {
  oneof value {
    bool bool_value = 1;
    uint32 uint8_value = 2;
    uint32 uint16_value = 3;
    uint32 uint32_value = 4;
    uint64 uint64_value = 5;
    int32 int8_value = 6;
    int32 int16_value = 7;
    int32 int32_value = 8;
    int64 int64_value = 9;
    float float32_value = 10;
    double float64_value = 11;
    string string_value = 12;
  }
}
