import "common_base.proto";

message CStorageDeviceManager_Adopt_Request {
	optional uint32 drive_id = 1;
	optional string label = 2;
}

message CStorageDeviceManager_Adopt_Response {
}

message CStorageDeviceManager_Eject_Request {
	optional uint32 drive_id = 1;
}

message CStorageDeviceManager_Eject_Response {
}

message CStorageDeviceManager_Format_Request {
	optional uint32 block_device_id = 1;
}

message CStorageDeviceManager_Format_Response {
}

message CStorageDeviceManager_GetState_Request {
}

message CStorageDeviceManager_GetState_Response {
	optional .CStorageDeviceManagerState state = 1;
}

message CStorageDeviceManager_IsServiceAvailable_Request {
}

message CStorageDeviceManager_IsServiceAvailable_Response {
	optional bool is_available = 1;
}

message CStorageDeviceManager_StateChanged_Notification {
}

message CStorageDeviceManager_TrimAll_Request {
}

message CStorageDeviceManager_TrimAll_Response {
}

message CStorageDeviceManager_Unmount_Request {
	optional uint32 block_device_id = 1;
}

message CStorageDeviceManager_Unmount_Response {
}

message CStorageDeviceManagerBlockDevice {
	optional uint32 id = 1 [default = 0];
	optional uint32 drive_id = 2 [default = 0];
	optional string path = 3;
	optional string friendly_path = 4;
	optional string label = 5;
	optional uint64 size_bytes = 6;
	optional bool is_formattable = 7;
	optional bool is_read_only = 8;
	optional bool is_root_device = 9;
	optional int32 content_type = 10 [(.description) = "enum"];
	optional int32 filesystem_type = 11 [(.description) = "enum"];
	repeated string mount_paths = 12;
	optional bool is_unmounting = 13;
}

message CStorageDeviceManagerDrive {
	optional uint32 id = 1 [default = 0];
	optional string model = 2;
	optional string vendor = 3;
	optional string serial = 4;
	optional bool is_ejectable = 5;
	optional uint64 size_bytes = 6;
	optional int32 media_type = 7 [(.description) = "enum"];
	optional bool is_unformatted = 8;
	optional int32 adopt_stage = 9 [(.description) = "enum"];
	optional bool is_formattable = 10;
	optional bool is_media_available = 11;
}

message CStorageDeviceManagerState {
	repeated .CStorageDeviceManagerDrive drives = 1;
	repeated .CStorageDeviceManagerBlockDevice block_devices = 2;
	optional bool is_unmount_supported = 3;
	optional bool is_trim_supported = 4;
	optional bool is_trim_running = 5;
	optional bool is_adopt_supported = 6;
}

service StorageDeviceManager {
	rpc Adopt (.CStorageDeviceManager_Adopt_Request) returns (.CStorageDeviceManager_Adopt_Response);
	rpc Eject (.CStorageDeviceManager_Eject_Request) returns (.CStorageDeviceManager_Eject_Response);
	rpc Format (.CStorageDeviceManager_Format_Request) returns (.CStorageDeviceManager_Format_Response);
	rpc GetState (.CStorageDeviceManager_GetState_Request) returns (.CStorageDeviceManager_GetState_Response);
	rpc IsServiceAvailable (.CStorageDeviceManager_IsServiceAvailable_Request) returns (.CStorageDeviceManager_IsServiceAvailable_Response);
	rpc NotifyStateChanged (.CStorageDeviceManager_StateChanged_Notification) returns (.NoResponse);
	rpc TrimAll (.CStorageDeviceManager_TrimAll_Request) returns (.CStorageDeviceManager_TrimAll_Response);
	rpc Unmount (.CStorageDeviceManager_Unmount_Request) returns (.CStorageDeviceManager_Unmount_Response);
}

