// https://git-aws.internal.justin.tv/systems/powercycle_service#api-endpoints

syntax = "proto3";

package code_justin_tv.rhys.nursery.ext.power.v1;
option go_package = "power_v1";

import "google/api/annotations.proto";

service Power {
  rpc GetStatus (GetStatusRequest) returns (GetStatusResponse) {
    option (google.api.http) = { get: "/api/v1/{device}" };
  }
  rpc GetPowerState (GetPowerStateRequest) returns (GetPowerStateResponse) {
    option (google.api.http) = { get: "/api/v1/{device}/power" };
  }
  rpc SetPowerState (SetPowerStateRequest) returns (SetPowerStateResponse) {
    option (google.api.http) = { put: "/api/v1/{device}/power", body: "*" };
  }
  rpc GetFruInfo (GetFruInfoRequest) returns (GetFruInfoResponse) {
    option (google.api.http) = { get: "/api/v1/{device}/fru" };
  }
  rpc SetBootDevice  (SetBootDeviceRequest) returns (SetBootDeviceResponse) {
    option (google.api.http) = { put: "/api/v1/{device}/bootdev", body: "*" };
  }
}

message GetStatusRequest {
  string device = 1;
}

message GetStatusResponse {
  string chassis_intrusion = 1;
  string cooling_fan_fault = 2;
  string drive_fault = 3;
  string front_panel_control = 4;
  string front_panel_lockout = 5;
  string last_power_event = 6;
  string main_power_fault = 7;
  string power_control_fault = 8;
  string power_interlock = 9;
  string power_overload = 10;
  string power_restore_policy = 11;
  string system_power = 12;
}

message GetPowerStateRequest {
  string device = 1;
}

message GetPowerStateResponse {
  string state = 1;
}

message SetPowerStateRequest {
  string device = 1;
  string state = 2;
}

message SetPowerStateResponse {
}

message GetFruInfoRequest {
  string device = 1;
}

message GetFruInfoResponse {
  string board_mfg = 1;
  string board_mfg_date = 2;
  string board_part_number = 3;
  string board_product = 4;
  string board_serial = 5;
  string chassis_serial = 6;
  string chassis_type = 7;
  string fru_device_description = 8;
  string product_manufacturer = 9;
  string product_name = 10;
  string product_part_number = 11;
  string product_serial = 12;
}

message SetBootDeviceRequest {
  string device = 1;
  string target = 2;
}

message SetBootDeviceResponse {
}
