syntax = "proto3";
package automation;

import "context.proto";

service AutomationService {
  rpc ZtpGetDeviceRole(DeviceRoleId) returns (DeviceRole) {}
  rpc ZtpGetDeviceRolesByDeviceId(context.DeviceId) returns (DeviceRoleList) {}
  rpc ZtpAdd(DeviceRole) returns (DeviceRoleState) {}
  rpc ZtpUpdate(DeviceRole) returns (DeviceRoleState) {}
  rpc ZtpDelete(DeviceRole) returns (DeviceRoleState) {}
  rpc ZtpDeleteAll(Empty) returns (DeviceDeletionResult) {}
}

enum DeviceRoleType {
  NONE = 0;
  DEV_OPS = 1;
  DEV_CONF = 2;
  PIPELINE_CONF = 3;
}

message DeviceRoleId {
  context.Uuid devRoleId = 1;
  context.DeviceId devId = 2;
}

message DeviceRole {
  DeviceRoleId devRoleId = 1;
  DeviceRoleType devRoleType = 2;
}

message DeviceRoleList {
  repeated DeviceRole devRole = 1;
}

message DeviceRoleState {
  DeviceRoleId devRoleId = 1;
  ZtpDeviceState devRoleState = 2;
}

message DeviceDeletionResult {
  repeated string deleted = 1;
}

message Empty {}

enum ZtpDeviceState {
  ZTP_DEV_STATE_UNDEFINED = 0;
  ZTP_DEV_STATE_CREATED  = 1;
  ZTP_DEV_STATE_UPDATED  = 2;
  ZTP_DEV_STATE_DELETED  = 3;
}
