import "common_base.proto";

message CHardwareUpdate_CheckForUpdates_Request {
}

message CHardwareUpdate_CheckForUpdates_Response {
	repeated .CMsgAvailableHardwareUpdate updates = 1;
}

message CHardwareUpdate_GetState_Request {
}

message CHardwareUpdate_GetState_Response {
	optional bool is_updater_supported = 1;
	optional bool has_seen_controllers = 2;
}

message CHardwareUpdate_PrepForUpdate_Request {
	optional string serial_number = 1;
}

message CHardwareUpdate_PrepForUpdate_Response {
}

message CHardwareUpdate_StateChanged_Notification {
}

message CHardwareUpdate_Update_Request {
	optional string serial_number = 1;
}

message CHardwareUpdate_Update_Response {
}

message CHardwareUpdate_UpdateProgress_Notification {
	optional int32 progress = 1;
}

message CHardwareUpdate_UpdateStateChanged_Notification {
}

message CMsgAvailableHardwareUpdate {
	optional uint32 etype = 1;
	optional uint32 hardware_id = 2;
	optional string serial_number = 3;
	optional string current_ts = 4;
	optional string update_ts = 5;
}

service HardwareUpdate {
	// ePrivilege=1, eClientExecutionSite=1
	rpc CheckForUpdates (.CHardwareUpdate_CheckForUpdates_Request) returns (.CHardwareUpdate_CheckForUpdates_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc GetState (.CHardwareUpdate_GetState_Request) returns (.CHardwareUpdate_GetState_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc NotifyStateChanged (.CHardwareUpdate_StateChanged_Notification) returns (.NoResponse);
	// ePrivilege=1, eClientExecutionSite=1
	rpc NotifyUpdateProgress (.CHardwareUpdate_UpdateProgress_Notification) returns (.NoResponse);
	// ePrivilege=1, eClientExecutionSite=1
	rpc NotifyUpdateStateChanged (.CHardwareUpdate_UpdateStateChanged_Notification) returns (.NoResponse);
	// ePrivilege=1, eClientExecutionSite=1
	rpc PrepForUpdate (.CHardwareUpdate_PrepForUpdate_Request) returns (.CHardwareUpdate_PrepForUpdate_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc Update (.CHardwareUpdate_Update_Request) returns (.CHardwareUpdate_Update_Response);
}

