import "google/protobuf/descriptor.proto";
import "steammessages_unified_base.steamclient.proto";

message CDeviceAuth_GetOwnAuthorizedDevices_Request {
	optional fixed64 steamid = 1;
	optional bool include_canceled = 2;
}

message CDeviceAuth_GetOwnAuthorizedDevices_Response {
	message Device {
		optional fixed64 auth_device_token = 1;
		optional string device_name = 2;
		optional bool is_pending = 3;
		optional bool is_canceled = 4;
		optional uint32 last_time_used = 5;
		optional fixed64 last_borrower_id = 6;
		optional uint32 last_app_played = 7;
		optional bool is_limited = 8;
	}

	repeated .CDeviceAuth_GetOwnAuthorizedDevices_Response.Device devices = 1;
}

message CDeviceAuth_AcceptAuthorizationRequest_Request {
	optional fixed64 steamid = 1;
	optional fixed64 auth_device_token = 2;
	optional fixed64 auth_code = 3;
	optional fixed64 from_steamid = 4;
}

message CDeviceAuth_AcceptAuthorizationRequest_Response {
}

message CDeviceAuth_AuthorizeRemoteDevice_Request {
	optional fixed64 steamid = 1;
	optional fixed64 auth_device_token = 2;
}

message CDeviceAuth_AuthorizeRemoteDevice_Response {
}

message CDeviceAuth_DeauthorizeRemoteDevice_Request {
	optional fixed64 steamid = 1;
	optional fixed64 auth_device_token = 2;
}

message CDeviceAuth_DeauthorizeRemoteDevice_Response {
}

message CDeviceAuth_GetUsedAuthorizedDevices_Request {
	optional fixed64 steamid = 1;
}

message CDeviceAuth_GetUsedAuthorizedDevices_Response {
	message Device {
		optional fixed64 auth_device_token = 1;
		optional string device_name = 2;
		optional fixed64 owner_steamid = 3;
		optional uint32 last_time_used = 4;
		optional uint32 last_app_played = 5;
	}

	repeated .CDeviceAuth_GetUsedAuthorizedDevices_Response.Device devices = 1;
}

message CDeviceAuth_GetAuthorizedBorrowers_Request {
	optional fixed64 steamid = 1;
	optional bool include_canceled = 2;
	optional bool include_pending = 3;
}

message CDeviceAuth_GetAuthorizedBorrowers_Response {
	message Borrower {
		optional fixed64 steamid = 1;
		optional bool is_pending = 2;
		optional bool is_canceled = 3;
		optional uint32 time_created = 4;
	}

	repeated .CDeviceAuth_GetAuthorizedBorrowers_Response.Borrower borrowers = 1;
}

message CDeviceAuth_AddAuthorizedBorrowers_Request {
	optional fixed64 steamid = 1;
	repeated fixed64 steamid_borrower = 2;
}

message CDeviceAuth_AddAuthorizedBorrowers_Response {
	optional int32 seconds_to_wait = 1;
}

message CDeviceAuth_RemoveAuthorizedBorrowers_Request {
	optional fixed64 steamid = 1;
	repeated fixed64 steamid_borrower = 2;
}

message CDeviceAuth_RemoveAuthorizedBorrowers_Response {
}

service DeviceAuth {
	option (service_description) = "Library Sharing settings service";
	rpc GetOwnAuthorizedDevices (.CDeviceAuth_GetOwnAuthorizedDevices_Request) returns (.CDeviceAuth_GetOwnAuthorizedDevices_Response) {
		option (method_description) = "Get list of authorized devices";
	}
	rpc AcceptAuthorizationRequest (.CDeviceAuth_AcceptAuthorizationRequest_Request) returns (.CDeviceAuth_AcceptAuthorizationRequest_Response) {
		option (method_description) = "Accept an authorization request by another users";
	}
	rpc AuthorizeRemoteDevice (.CDeviceAuth_AuthorizeRemoteDevice_Request) returns (.CDeviceAuth_AuthorizeRemoteDevice_Response) {
		option (method_description) = "Authorize own remote device that has pending request";
	}
	rpc DeauthorizeRemoteDevice (.CDeviceAuth_DeauthorizeRemoteDevice_Request) returns (.CDeviceAuth_DeauthorizeRemoteDevice_Response) {
		option (method_description) = "Revoke own device authorization";
	}
	rpc GetUsedAuthorizedDevices (.CDeviceAuth_GetUsedAuthorizedDevices_Request) returns (.CDeviceAuth_GetUsedAuthorizedDevices_Response) {
		option (method_description) = "Get list of authorized devices user played borrowed games on";
	}
	rpc GetAuthorizedBorrowers (.CDeviceAuth_GetAuthorizedBorrowers_Request) returns (.CDeviceAuth_GetAuthorizedBorrowers_Response) {
		option (method_description) = "Get list of users that can borrow on an authorized device";
	}
	rpc AddAuthorizedBorrowers (.CDeviceAuth_AddAuthorizedBorrowers_Request) returns (.CDeviceAuth_AddAuthorizedBorrowers_Response) {
		option (method_description) = "Add users that can borrow on limited authorized devices";
	}
	rpc RemoveAuthorizedBorrowers (.CDeviceAuth_RemoveAuthorizedBorrowers_Request) returns (.CDeviceAuth_RemoveAuthorizedBorrowers_Response) {
		option (method_description) = "Remove users that can borrow on limited authorized devices";
	}
}
