syntax = "proto3";

package vemmiopb;

import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "vemmio_client/accelerometer.proto";
import "vemmio_client/battery.proto";
import "vemmio_client/bsensor.proto";
import "vemmio_client/carbon_dioxide.proto";
import "vemmio_client/carbon_monoxide.proto";
import "vemmio_client/color.proto";
import "vemmio_client/door.proto";
import "vemmio_client/doorbell.proto";
import "vemmio_client/emergency.proto";
import "vemmio_client/firmware.proto";
import "vemmio_client/flood.proto";
import "vemmio_client/gate.proto";
import "vemmio_client/level.proto";
import "vemmio_client/lock.proto";
import "vemmio_client/metadata.proto";
import "vemmio_client/meter.proto";
import "vemmio_client/power_source.proto";
import "vemmio_client/remote.proto";
import "vemmio_client/roller_shutter.proto";
import "vemmio_client/seismic.proto";
import "vemmio_client/sensor.proto";
import "vemmio_client/siren.proto";
import "vemmio_client/smoke.proto";
import "vemmio_client/status.proto";
import "vemmio_client/structure.proto";
import "vemmio_client/switch.proto";
import "vemmio_client/tamper.proto";
import "vemmio_client/taptap.proto";
import "vemmio_client/temperature.proto";
import "vemmio_client/thermostat.proto";
import "vemmio_client/ultraviolet.proto";

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

service Reports {
  rpc Subscribe(ReportRequest) returns (stream DeviceReport);
}

message ReportRequest {}

message DeviceReport {
  reserved 28;
  DeviceMetadata metadata = 1;
  google.protobuf.Timestamp timestamp = 2;
  oneof report {
    SwitchReport switch = 3;
    MeterReport power_meter = 4;
    MeterReport gas_meter = 5;
    MeterReport water_meter = 6;
    OpenCloseReport open_close = 7;
    SmokeReport smoke = 8;
    MotionReport motion = 9;
    FloodReport flood = 10;
    CarbonMonoxideStateReport carbon_monoxide_state = 11;
    TemperatureReport temperature = 12;
    HumidityReport humidity = 13;
    IlluminationReport illumination = 14;
    DirectionReport direction = 15;
    ThermostatModeReport thermostat_mode = 16;
    ThermostatSetpointReport thermostat_setpoint = 17;
    ThermostatFanModeReport thermostat_fan_mode = 18;
    TamperReport tamper = 19;
    EmergencyReport emergency = 20;
    DoorReport door = 21;
    TapTapReport tap_tap = 22;
    ColorReport color = 23;
    LevelReport level = 24;
    BatteryReport battery = 25;
    RemoteReport remote = 26;
    LockReport lock = 27;
    DoorbellReport doorbell = 29;
    PowerSourceReport power_source = 30;
    SirenReport siren = 31;
    ToneReport tone = 32;
    VolumeReport volume = 33;
    AccelerometerReport accelerometer = 34;
    SeismicIntensityReport seismic_intensity = 35;
    SeismicMagnitudeReport seismic_magnitude = 36;
    RollerShutterLevelReport roller_shutter_level = 37;
    CarbonDioxideReport carbon_dioxide = 38;
    CarbonMonoxideValueReport carbon_monoxide_value = 39;
    UltravioletReport ultraviolet = 40;
    GateReport gate = 41;
  }
}

message ConnectivityReport {
  google.protobuf.Timestamp timestamp = 1;
  State state = 2;
  google.protobuf.Duration uptime = 3;
  enum State {
    DISCONNECTED = 0;
    CONNECTED = 1;
    UPTIME = 2;
  }
}

message GatewayReport {
  reserved 4;
  string mac = 1;
  oneof report {
    ConnectivityReport connectivity = 2;
    DeviceReport device = 3;
    StatusCheckReport status_check = 5;
    FirmwareUpdateStatusReport firmware_update_status = 6;
    StructureReport structure = 7;
  }
}
