syntax = "proto2";
import "steammessages_base.proto";
import "steammessages_unified_base.proto";

option py_generic_services = true;

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 {
}

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

message CDeviceAuth_GetAuthorizedAsBorrower_Response {
	message Lender {
		optional fixed64 steamid = 1;
		optional uint32 time_created = 2;
		optional bool is_pending = 3;
		optional bool is_canceled = 4;
		optional bool is_used = 5;
		optional uint32 time_removed = 6;
		optional uint32 time_first = 7;
	}

	repeated .CDeviceAuth_GetAuthorizedAsBorrower_Response.Lender lenders = 1;
}

message CDeviceAuth_GetExcludedGamesInLibrary_Request {
	optional fixed64 steamid = 1;
}

message CDeviceAuth_GetExcludedGamesInLibrary_Response {
	message ExcludedGame {
		optional uint32 appid = 1;
		optional string game_name = 2;
		optional bool vac_banned = 3;
		optional bool package_excluded = 4;
	}

	repeated .CDeviceAuth_GetExcludedGamesInLibrary_Response.ExcludedGame excluded_games = 1;
}

message CDeviceAuth_GetBorrowerPlayHistory_Request {
	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
}

message CDeviceAuth_GetBorrowerPlayHistory_Response {
	message GameHistory {
		optional uint32 appid = 1;
		optional uint32 time_last = 2;
		optional uint32 time_total = 3;
	}

	message LenderHistory {
		optional fixed64 steamid = 1;
		repeated .CDeviceAuth_GetBorrowerPlayHistory_Response.GameHistory game_history = 2;
	}

	repeated .CDeviceAuth_GetBorrowerPlayHistory_Response.LenderHistory lender_history = 1;
}

service DeviceAuth {
	rpc GetOwnAuthorizedDevices (.CDeviceAuth_GetOwnAuthorizedDevices_Request) returns (.CDeviceAuth_GetOwnAuthorizedDevices_Response);
	rpc AcceptAuthorizationRequest (.CDeviceAuth_AcceptAuthorizationRequest_Request) returns (.CDeviceAuth_AcceptAuthorizationRequest_Response);
	rpc AuthorizeRemoteDevice (.CDeviceAuth_AuthorizeRemoteDevice_Request) returns (.CDeviceAuth_AuthorizeRemoteDevice_Response);
	rpc DeauthorizeRemoteDevice (.CDeviceAuth_DeauthorizeRemoteDevice_Request) returns (.CDeviceAuth_DeauthorizeRemoteDevice_Response);
	rpc GetUsedAuthorizedDevices (.CDeviceAuth_GetUsedAuthorizedDevices_Request) returns (.CDeviceAuth_GetUsedAuthorizedDevices_Response);
	rpc GetAuthorizedBorrowers (.CDeviceAuth_GetAuthorizedBorrowers_Request) returns (.CDeviceAuth_GetAuthorizedBorrowers_Response);
	rpc AddAuthorizedBorrowers (.CDeviceAuth_AddAuthorizedBorrowers_Request) returns (.CDeviceAuth_AddAuthorizedBorrowers_Response);
	rpc RemoveAuthorizedBorrowers (.CDeviceAuth_RemoveAuthorizedBorrowers_Request) returns (.CDeviceAuth_RemoveAuthorizedBorrowers_Response);
	rpc GetAuthorizedAsBorrower (.CDeviceAuth_GetAuthorizedAsBorrower_Request) returns (.CDeviceAuth_GetAuthorizedAsBorrower_Response);
	rpc GetExcludedGamesInLibrary (.CDeviceAuth_GetExcludedGamesInLibrary_Request) returns (.CDeviceAuth_GetExcludedGamesInLibrary_Response);
	rpc GetBorrowerPlayHistory (.CDeviceAuth_GetBorrowerPlayHistory_Request) returns (.CDeviceAuth_GetBorrowerPlayHistory_Response);
}
