import "steammessages_base.proto";
import "steammessages_unified_base.steamclient.proto";

option cc_generic_services = true;

message CContentBuilder_InitDepotBuild_Request {
	optional uint32 appid = 1;
	optional uint32 depotid = 2;
	optional uint64 workshop_itemid = 3;
	optional bool for_local_cs = 4;
	optional string target_branch = 5;
	optional bool shader_depot = 6;
}

message CContentBuilder_InitDepotBuild_Response {
	optional uint64 baseline_manifestid = 1;
	optional uint32 chunk_size = 2;
	optional bytes aes_key = 3;
	optional bytes rsa_key = 4;
	optional string url_host = 5;
	optional bool offset_detection_enabled = 6;
	optional uint32 offset_detection_min_clean_chunk = 7;
	optional uint32 offset_detection_blast_radius_pre = 8;
	optional uint32 offset_detection_blast_radius_post = 9;
	optional uint32 offset_detection_max_distance_pre = 10;
	optional uint32 offset_detection_max_distance_post = 11;
	optional uint32 compression_method = 12;
	optional string download_host = 13;
	optional uint64 manifest_request_code = 14;
}

message CContentBuilder_StartDepotUpload_Request {
	optional uint32 appid = 1;
	optional uint32 depotid = 2;
	optional uint64 workshop_itemid = 3;
	optional bool for_local_cs = 4;
	optional uint64 baseline_manifestid = 5;
	optional uint32 manifest_size = 6;
}

message CContentBuilder_StartDepotUpload_Response {
	optional uint64 depot_build_handle = 1;
}

message CContentBuilder_GetMissingDepotChunks_Request {
	optional uint32 appid = 1;
	optional uint64 depot_build_handle = 2;
}

message CContentBuilder_GetMissingDepotChunks_Response {
	message Chunks {
		optional bytes sha = 1;
	}

	repeated .CContentBuilder_GetMissingDepotChunks_Response.Chunks missing_chunks = 1;
	optional uint32 total_missing_chunks = 2;
	optional uint64 total_missing_bytes = 3;
}

message CContentBuilder_FinishDepotUpload_Request {
	optional uint32 appid = 1;
	optional uint64 depot_build_handle = 2;
}

message CContentBuilder_FinishDepotUpload_Response {
	optional uint64 manifestid = 1;
	optional bool prev_reused = 2;
	optional uint64 manifest_request_code = 3;
}

message CContentBuilder_CommitAppBuild_Request {
	message Depots {
		optional uint32 depotid = 1;
		optional uint64 manifestid = 2;
	}

	optional uint32 appid = 1;
	repeated .CContentBuilder_CommitAppBuild_Request.Depots depot_manifests = 2;
	optional string build_notes = 4;
	optional string live_branch = 5;
	optional bool for_local_cs = 6;
}

message CContentBuilder_CommitAppBuild_Response {
	optional uint32 buildid = 1;
}

message CContentBuilder_SignInstallScript_Request {
	optional uint32 appid = 1;
	optional uint32 depotid = 2;
	optional string install_script = 3;
}

message CContentBuilder_SignInstallScript_Response {
	optional string signed_install_script = 1;
}

service ContentBuilder {
	rpc InitDepotBuild (.CContentBuilder_InitDepotBuild_Request) returns (.CContentBuilder_InitDepotBuild_Response);
	rpc StartDepotUpload (.CContentBuilder_StartDepotUpload_Request) returns (.CContentBuilder_StartDepotUpload_Response);
	rpc GetMissingDepotChunks (.CContentBuilder_GetMissingDepotChunks_Request) returns (.CContentBuilder_GetMissingDepotChunks_Response);
	rpc FinishDepotUpload (.CContentBuilder_FinishDepotUpload_Request) returns (.CContentBuilder_FinishDepotUpload_Response);
	rpc CommitAppBuild (.CContentBuilder_CommitAppBuild_Request) returns (.CContentBuilder_CommitAppBuild_Response);
	rpc SignInstallScript (.CContentBuilder_SignInstallScript_Request) returns (.CContentBuilder_SignInstallScript_Response);
}
