import "google/protobuf/descriptor.proto";

option optimize_for = SPEED;
option cc_generic_services = false;

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

extend .google.protobuf.MessageOptions {
	optional int32 msgpool_soft_limit = 60000 [default = 32];
	optional int32 msgpool_hard_limit = 60001 [default = 384];
}

enum GCProtoBufMsgSrc {
	GCProtoBufMsgSrc_Unspecified = 0;
	GCProtoBufMsgSrc_FromSystem = 1;
	GCProtoBufMsgSrc_FromSteamID = 2;
	GCProtoBufMsgSrc_FromGC = 3;
	GCProtoBufMsgSrc_ReplySystem = 4;
}

message CMsgProtoBufHeader {
	option (msgpool_soft_limit) = 256;
	option (msgpool_hard_limit) = 1024;

	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;
	optional int32 eresult = 13 [default = 2];
	optional string error_message = 14;
	optional .GCProtoBufMsgSrc gc_msg_src = 200 [default = GCProtoBufMsgSrc_Unspecified];
	optional uint32 gc_dir_index_source = 201;
}

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;
	optional uint32 absolute_timeout = 8;
}

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;
	optional uint32 owner_id = 3;
}

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

message CGCMsgMemCachedStatsResponse {
	optional uint64 curr_connections = 1;
	optional uint64 cmd_get = 2;
	optional uint64 cmd_set = 3;
	optional uint64 cmd_flush = 4;
	optional uint64 get_hits = 5;
	optional uint64 get_misses = 6;
	optional uint64 delete_hits = 7;
	optional uint64 delete_misses = 8;
	optional uint64 bytes_read = 9;
	optional uint64 bytes_written = 10;
	optional uint64 limit_maxbytes = 11;
	optional uint64 curr_items = 12;
	optional uint64 evictions = 13;
	optional uint64 bytes = 14;
}

message CGCMsgSQLStats {
	optional uint32 schema_catalog = 1;
}

message CGCMsgSQLStatsResponse {
	optional uint32 threads = 1;
	optional uint32 threads_connected = 2;
	optional uint32 threads_active = 3;
	optional uint32 operations_submitted = 4;
	optional uint32 prepared_statements_executed = 5;
	optional uint32 non_prepared_statements_executed = 6;
	optional uint32 deadlock_retries = 7;
	optional uint32 operations_timed_out_in_queue = 8;
	optional uint32 errors = 9;
}

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

message CMsgAMGrantGuestPasses2 {
	optional fixed64 steam_id = 1;
	optional uint32 package_id = 2;
	optional int32 passes_to_grant = 3;
	optional int32 days_to_expiration = 4;
	optional int32 action = 5;
}

message CMsgAMGrantGuestPasses2Response {
	optional int32 eresult = 1 [default = 2];
	optional int32 passes_granted = 2 [default = 0];
}

message CGCSystemMsg_GetAccountDetails {
	option (msgpool_soft_limit) = 128;
	option (msgpool_hard_limit) = 512;

	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
}

message CGCSystemMsg_GetAccountDetails_Response {
	option (msgpool_soft_limit) = 128;
	option (msgpool_hard_limit) = 512;

	optional uint32 eresult_deprecated = 1 [default = 2];
	optional string account_name = 2;
	optional string persona_name = 3;
	optional bool is_profile_public = 4;
	optional bool is_inventory_public = 5;
	optional bool is_vac_banned = 7;
	optional bool is_cyber_cafe = 8;
	optional bool is_school_account = 9;
	optional bool is_limited = 10;
	optional bool is_subscribed = 11;
	optional uint32 package = 12;
	optional bool is_free_trial_account = 13;
	optional uint32 free_trial_expiration = 14;
	optional bool is_low_violence = 15;
	optional bool is_account_locked_down = 16;
	optional bool is_community_banned = 17;
	optional bool is_trade_banned = 18;
	optional uint32 trade_ban_expiration = 19;
	optional uint32 accountid = 20;
	optional uint32 suspension_end_time = 21;
	optional string currency = 22;
	optional uint32 steam_level = 23;
	optional uint32 friend_count = 24;
	optional uint32 account_creation_time = 25;
	optional bool is_steamguard_enabled = 27;
	optional bool is_phone_verified = 28;
	optional bool is_two_factor_auth_enabled = 29;
	optional uint32 two_factor_enabled_time = 30;
	optional uint32 phone_verification_time = 31;
	optional uint64 phone_id = 33;
	optional bool is_phone_identifying = 34;
	optional uint32 rt_identity_linked = 35;
	optional uint32 rt_birth_date = 36;
	optional string txn_country_code = 37;
}

message CMsgGCCheckClanMembership {
	optional fixed64 steamid = 1;
	optional uint32 clanid = 2;
}

message CMsgGCCheckClanMembership_Response {
	optional bool ismember = 1;
}

message CMsgGCGetPersonaNames {
	repeated fixed64 steamids = 1;
}

message CMsgGCGetPersonaNames_Response {
	message PersonaName {
		optional fixed64 steamid = 1;
		optional string persona_name = 2;
	}

	repeated .CMsgGCGetPersonaNames_Response.PersonaName succeeded_lookups = 1;
	repeated fixed64 failed_lookup_steamids = 2;
}

message CMsgGCCheckFriendship {
	optional fixed64 steamid_left = 1;
	optional fixed64 steamid_right = 2;
}

message CMsgGCCheckFriendship_Response {
	optional bool success = 1;
	optional bool found_friendship = 2;
}

message CMsgGCMsgMasterSetDirectory {
	message SubGC {
		optional uint32 dir_index = 1;
		optional string name = 2;
		optional string box = 3;
		optional string command_line = 4;
		optional string gc_binary = 5;
	}

	optional uint32 master_dir_index = 1;
	repeated .CMsgGCMsgMasterSetDirectory.SubGC dir = 2;
}

message CMsgGCMsgMasterSetDirectory_Response {
	optional int32 eresult = 1 [default = 2];
}

message CMsgGCMsgWebAPIJobRequestForwardResponse {
	optional uint32 dir_index = 1;
}

message CGCSystemMsg_GetPurchaseTrust_Request {
	optional fixed64 steamid = 1;
}

message CGCSystemMsg_GetPurchaseTrust_Response {
	optional bool has_prior_purchase_history = 1;
	optional bool has_no_recent_password_resets = 2;
	optional bool is_wallet_cash_trusted = 3;
	optional uint32 time_all_trusted = 4;
}

message CMsgGCHAccountVacStatusChange {
	optional fixed64 steam_id = 1;
	optional uint32 app_id = 2;
	optional uint32 rtime_vacban_starts = 3;
	optional bool is_banned_now = 4;
	optional bool is_banned_future = 5;
}

message CMsgGCHAccountTradeBanStatusChange {
	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
	optional bool is_banned = 3;
	optional uint32 time_banned_until = 4;
}

message CMsgGCHAccountLockStatusChange {
	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
	optional bool is_locked = 3;
}

message CMsgGCHVacVerificationChange {
	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
	optional bool is_verified = 3;
}

message CMsgGCHAccountPhoneNumberChange {
	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
	optional uint64 phone_id = 3;
	optional bool is_verified = 4;
	optional bool is_identifying = 5;
}

message CMsgGCHAccountTwoFactorChange {
	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
	optional bool twofactor_enabled = 3;
}

message CMsgGCGetPartnerAccountLink {
	optional fixed64 steamid = 1;
}

message CMsgGCGetPartnerAccountLink_Response {
	optional uint32 pwid = 1;
	optional uint32 nexonid = 2;
}

message CMsgGCRoutingInfo {
	enum RoutingMethod {
		RANDOM = 0;
		DISCARD = 1;
		CLIENT_STEAMID = 2;
		PROTOBUF_FIELD_UINT64 = 3;
		WEBAPI_PARAM_UINT64 = 4;
	}

	repeated uint32 dir_index = 1;
	optional .CMsgGCRoutingInfo.RoutingMethod method = 2 [default = RANDOM];
	optional .CMsgGCRoutingInfo.RoutingMethod fallback = 3 [default = DISCARD];
	optional uint32 protobuf_field = 4;
	optional string webapi_param = 5;
}

message CMsgGCMsgMasterSetWebAPIRouting {
	message Entry {
		optional string interface_name = 1;
		optional string method_name = 2;
		optional .CMsgGCRoutingInfo routing = 3;
	}

	repeated .CMsgGCMsgMasterSetWebAPIRouting.Entry entries = 1;
}

message CMsgGCMsgMasterSetClientMsgRouting {
	message Entry {
		optional uint32 msg_type = 1;
		optional .CMsgGCRoutingInfo routing = 2;
	}

	repeated .CMsgGCMsgMasterSetClientMsgRouting.Entry entries = 1;
}

message CMsgGCMsgMasterSetWebAPIRouting_Response {
	optional int32 eresult = 1 [default = 2];
}

message CMsgGCMsgMasterSetClientMsgRouting_Response {
	optional int32 eresult = 1 [default = 2];
}

message CMsgGCMsgSetOptions {
	message MessageRange {
		required uint32 low = 1;
		required uint32 high = 2;
	}

	enum Option {
		NOTIFY_USER_SESSIONS = 0;
		NOTIFY_SERVER_SESSIONS = 1;
		NOTIFY_ACHIEVEMENTS = 2;
		NOTIFY_VAC_ACTION = 3;
	}

	enum GCSQLVersion {
		GCSQL_VERSION_BASELINE = 1;
		GCSQL_VERSION_BOOLTYPE = 2;
	}

	repeated .CMsgGCMsgSetOptions.Option options = 1;
	repeated .CMsgGCMsgSetOptions.MessageRange client_msg_ranges = 2;
	optional .CMsgGCMsgSetOptions.GCSQLVersion gcsql_version = 3 [default = GCSQL_VERSION_BASELINE];
}

message CMsgGCHUpdateSession {
	message ExtraField {
		optional string name = 1;
		optional string value = 2;
	}

	optional fixed64 steam_id = 1;
	optional uint32 app_id = 2;
	optional bool online = 3;
	optional fixed64 server_steam_id = 4;
	optional uint32 server_addr = 5;
	optional uint32 server_port = 6;
	optional uint32 os_type = 7;
	optional uint32 client_addr = 8;
	repeated .CMsgGCHUpdateSession.ExtraField extra_fields = 9;
}

message CMsgNotificationOfSuspiciousActivity {
	message MultipleGameInstances {
		optional uint32 app_instance_count = 1;
		repeated fixed64 other_steamids = 2;
	}

	optional fixed64 steamid = 1;
	optional uint32 appid = 2;
	optional .CMsgNotificationOfSuspiciousActivity.MultipleGameInstances multiple_instances = 3;
}
