syntax = "proto3";

package pagerino.device;
option go_package = "server/app_comm/api/device;api_device";

import "google/protobuf/timestamp.proto";
import "common.proto";


message Charge {
  float charge = 1;
}

message Location {
  double latitude = 1;
  double longitude = 2;
  float altitude = 3;
}

message DeviceBaseInfo {
  string name = 1;
  string euid = 2;
  sint32 internal_status = 3;
  google.protobuf.Timestamp last_online = 4;
}

message DeviceAllInfo { // Meta not included!
  string name = 1;
  string euid = 2;
  
  sint32 internal_status = 3;
  string native_status = 4;

  google.protobuf.Timestamp last_online = 5;
  string fw_version = 6;
  
  repeated int32 card_ids = 7;

  float charge = 8;

  double latitude = 9;
  double longitude = 10;
  float altitude = 11;
}


service DeviceService {
  // === DB information
  rpc GetAll(common.StrIndex) returns (DeviceAllInfo);
  rpc GetInfo(common.StrIndex) returns (DeviceBaseInfo);
  rpc GetCharge(common.StrIndex) returns (Charge);
  rpc GetLocation(common.StrIndex) returns (Location);
  
  // References
  rpc GetNfcCardIds(common.StrIndex) returns (common.References);
  rpc GetStatusIds(common.StrIndex) returns (common.References);
  rpc GetSentMessageIds(common.StrIndex) returns (common.References);
  rpc GetReceivedMessageIds(common.StrIndex) returns (common.References);
  rpc GetLogs(common.StrIndex) returns (common.References);
  
  // Common
  rpc GetActivity(common.StrIndex) returns (common.Activity);
  rpc GetMeta(common.StrIndex) returns (common.Meta);
}

