import "google/protobuf/descriptor.proto";

option optimize_for = SPEED;
option cc_generic_services = false;

extend .google.protobuf.FieldOptions {
	optional bool key_field = 50000 [default = false];
	optional bool hidden = 50001 [default = false];
}

message CMsgProtoBufHeader {
	optional fixed64 client_steam_id = 1;
	optional int32 client_session_id = 2;
	optional uint32 source_app_id = 3;
	optional fixed64 job_id_source = 10 [default = 18446744073709551615];
	optional fixed64 job_id_target = 11 [default = 18446744073709551615];
	optional string target_job_name = 12;
}

message CMsgWebAPIKey {
	optional uint32 status = 1 [default = 255];
	optional uint32 account_id = 2 [default = 0];
	optional uint32 publisher_group_id = 3 [default = 0];
	optional uint32 key_id = 4;
	optional string domain = 5;
}

message CMsgHttpRequest {
	message RequestHeader {
		optional string name = 1;
		optional string value = 2;
	}

	message QueryParam {
		optional string name = 1;
		optional bytes value = 2;
	}

	optional uint32 request_method = 1;
	optional string hostname = 2;
	optional string url = 3;
	repeated .CMsgHttpRequest.RequestHeader headers = 4;
	repeated .CMsgHttpRequest.QueryParam get_params = 5;
	repeated .CMsgHttpRequest.QueryParam post_params = 6;
	optional bytes body = 7;
}

message CMsgWebAPIRequest {
	optional string UNUSED_job_name = 1;
	optional string interface_name = 2;
	optional string method_name = 3;
	optional uint32 version = 4;
	optional .CMsgWebAPIKey api_key = 5;
	optional .CMsgHttpRequest request = 6;
	optional uint32 routing_app_id = 7;
}

message CMsgHttpResponse {
	message ResponseHeader {
		optional string name = 1;
		optional string value = 2;
	}

	optional uint32 status_code = 1;
	repeated .CMsgHttpResponse.ResponseHeader headers = 2;
	optional bytes body = 3;
}

message CMsgAMFindAccounts {
	optional uint32 search_type = 1;
	optional string search_string = 2;
}

message CMsgAMFindAccountsResponse {
	repeated fixed64 steam_id = 1;
}

message CMsgNotifyWatchdog {
	optional uint32 source = 1;
	optional uint32 alert_type = 2;
	optional uint32 alert_destination = 3;
	optional bool critical = 4;
	optional uint32 time = 5;
	optional uint32 appid = 6;
	optional string text = 7;
}

message CMsgAMGetLicenses {
	optional fixed64 steamid = 1;
}

message CMsgPackageLicense {
	optional uint32 package_id = 1;
	optional uint32 time_created = 2;
}

message CMsgAMGetLicensesResponse {
	repeated .CMsgPackageLicense license = 1;
	optional uint32 result = 2;
}

message CMsgAMGetUserGameStats {
	optional fixed64 steam_id = 1;
	optional fixed64 game_id = 2;
	repeated uint32 stats = 3;
}

message CMsgAMGetUserGameStatsResponse {
	message Stats {
		optional uint32 stat_id = 1;
		optional uint32 stat_value = 2;
	}

	message Achievement_Blocks {
		optional uint32 achievement_id = 1;
		optional uint32 achievement_bit_id = 2;
		optional fixed32 unlock_time = 3;
	}

	optional fixed64 steam_id = 1;
	optional fixed64 game_id = 2;
	optional int32 eresult = 3 [default = 2];
	repeated .CMsgAMGetUserGameStatsResponse.Stats stats = 4;
	repeated .CMsgAMGetUserGameStatsResponse.Achievement_Blocks achievement_blocks = 5;
}

message CMsgGCGetCommandList {
	optional uint32 app_id = 1;
	optional string command_prefix = 2;
}

message CMsgGCGetCommandListResponse {
	repeated string command_name = 1;
}

message CGCMsgMemCachedGet {
	repeated string keys = 1;
}

message CGCMsgMemCachedGetResponse {
	message ValueTag {
		optional bool found = 1;
		optional bytes value = 2;
	}

	repeated .CGCMsgMemCachedGetResponse.ValueTag values = 1;
}

message CGCMsgMemCachedSet {
	message KeyPair {
		optional string name = 1;
		optional bytes value = 2;
	}

	repeated .CGCMsgMemCachedSet.KeyPair keys = 1;
}

message CGCMsgMemCachedDelete {
	repeated string keys = 1;
}

message CMsgAMAddFreeLicense {
	optional fixed64 steamid = 1;
	optional uint32 ip_public = 2;
	optional uint32 packageid = 3;
	optional string store_country_code = 4;
}

message CMsgAMAddFreeLicenseResponse {
	optional int32 eresult = 1 [default = 2];
	optional int32 purchase_result_detail = 2;
	optional fixed64 transid = 3;
}

message CGCMsgGetIPLocation {
	repeated fixed32 ips = 1;
}

message CIPLocationInfo {
	optional uint32 ip = 1;
	optional float latitude = 2;
	optional float longitude = 3;
	optional string country = 4;
	optional string state = 5;
	optional string city = 6;
}

message CGCMsgGetIPLocationResponse {
	repeated .CIPLocationInfo infos = 1;
}

message CGCMsgSystemStatsSchema {
	optional uint32 gc_app_id = 1;
	optional bytes schema_kv = 2;
}

message CGCMsgGetSystemStats {
}

message CGCMsgGetSystemStatsResponse {
	optional uint32 gc_app_id = 1;
	optional bytes stats_kv = 2;
	optional uint32 active_jobs = 3;
	optional uint32 yielding_jobs = 4;
	optional uint32 user_sessions = 5;
	optional uint32 game_server_sessions = 6;
	optional uint32 socaches = 7;
	optional uint32 socaches_to_unload = 8;
	optional uint32 socaches_loading = 9;
	optional uint32 writeback_queue = 10;
	optional uint32 steamid_locks = 11;
	optional uint32 logon_queue = 12;
	optional uint32 logon_jobs = 13;
}

message CMsgAMSendEmail {
	message ReplacementToken {
		optional string token_name = 1;
		optional string token_value = 2;
	}

	message PersonaNameReplacementToken {
		optional fixed64 steamid = 1;
		optional string token_name = 2;
	}

	optional fixed64 steamid = 1;
	optional uint32 email_msg_type = 2;
	optional uint32 email_format = 3;
	repeated .CMsgAMSendEmail.PersonaNameReplacementToken persona_name_tokens = 5;
	optional uint32 source_gc = 6;
	repeated .CMsgAMSendEmail.ReplacementToken tokens = 7;
}

message CMsgAMSendEmailResponse {
	optional uint32 eresult = 1 [default = 2];
}

message CMsgGCGetEmailTemplate {
	optional uint32 app_id = 1;
	optional uint32 email_msg_type = 2;
	optional int32 email_lang = 3;
	optional int32 email_format = 4;
}

message CMsgGCGetEmailTemplateResponse {
	optional uint32 eresult = 1 [default = 2];
	optional bool template_exists = 2;
	optional string template = 3;
}
