import "steammessages_unified_base.steamworkssdk.proto";

message CPublishedFile_Subscribe_Request {
	optional uint64 publishedfileid = 1;
	optional uint32 list_type = 2;
	optional int32 appid = 3;
	optional bool notify_client = 4;
}

message CPublishedFile_Subscribe_Response {
}

message CPublishedFile_Unsubscribe_Request {
	optional uint64 publishedfileid = 1;
	optional uint32 list_type = 2;
	optional int32 appid = 3;
	optional bool notify_client = 4;
}

message CPublishedFile_Unsubscribe_Response {
}

message CPublishedFile_Publish_Request {
	optional uint32 appid = 1 [(description) = "App Id this file is being published FROM."];
	optional uint32 consumer_appid = 2 [(description) = "App Id this file is being published TO."];
	optional string cloudfilename = 3 [(description) = "Name of the file to publish in the user's cloud."];
	optional string preview_cloudfilename = 4 [(description) = "Name of the file to use as the published file's preview."];
	optional string title = 5 [(description) = "Text title for the published file."];
	optional string file_description = 6 [(description) = "Text description for the published file."];
	optional uint32 file_type = 7 [(description) = "(EWorkshopFileType) Type of Workshop file to publish."];
	optional string consumer_shortcut_name = 8 [(description) = "Shortcut name for the published file."];
	optional string youtube_username = 9 [(description) = "(Optional) User's YouTube account username."];
	optional string youtube_videoid = 10 [(description) = "(Optional) Video Id of a YouTube video for this published file."];
	optional uint32 visibility = 11 [(description) = "(ERemoteStoragePublishedFileVisibility) Visibility of the published file (private, friends, public, etc.)"];
	optional string redirect_uri = 12 [(description) = "(Optional) If supplied, the resulting published file's Id is appended to the URI."];
	repeated string tags = 13 [(description) = "Array of text tags to apply to the published file."];
	optional string collection_type = 14 [(description) = "(Optional) Type of collection the published file represents."];
	optional string game_type = 15 [(description) = "(Optional) Type of game the published file represents."];
	optional string url = 16 [(description) = "(Optional) If this represents a game, this is the URL to that game's page."];
}

message CPublishedFile_Publish_Response {
	optional uint64 publishedfileid = 1;
	optional string redirect_uri = 2;
}

message CPublishedFile_GetDetails_Request {
	repeated fixed64 publishedfileids = 1 [(description) = "Set of published file Ids to retrieve details for."];
	optional bool includetags = 2 [(description) = "If true, return tag information in the returned details."];
	optional bool includeadditionalpreviews = 3 [(description) = "If true, return preview information in the returned details."];
	optional bool includechildren = 4 [(description) = "If true, return children in the returned details."];
	optional bool includekvtags = 5 [(description) = "If true, return key value tags in the returned details."];
	optional bool includevotes = 6 [(description) = "If true, return vote data in the returned details."];
	optional bool short_description = 8 [(description) = "If true, return a short description instead of the full description."];
}

message PublishedFileDetails {
	message Tag {
		optional string tag = 1;
		optional bool adminonly = 2;
	}

	message Preview {
		optional uint64 previewid = 1;
		optional uint32 sortorder = 2;
		optional string url = 3;
		optional uint32 size = 4;
		optional string filename = 5;
		optional string youtubevideoid = 6;
	}

	message Child {
		optional uint64 publishedfileid = 1;
		optional uint32 sortorder = 2;
		optional uint32 file_type = 3;
	}

	message KVTag {
		optional string key = 1;
		optional string value = 2;
	}

	message VoteData {
		optional float score = 1;
		optional uint32 votes_up = 2;
		optional uint32 votes_down = 3;
	}

	optional uint32 result = 1;
	optional uint64 publishedfileid = 2;
	optional fixed64 creator = 3;
	optional uint32 creator_appid = 4;
	optional uint32 consumer_appid = 5;
	optional uint32 consumer_shortcutid = 6;
	optional string filename = 7;
	optional uint64 file_size = 8;
	optional uint64 preview_file_size = 9;
	optional string file_url = 10;
	optional string preview_url = 11;
	optional string youtubevideoid = 12;
	optional string url = 13;
	optional fixed64 hcontent_file = 14;
	optional fixed64 hcontent_preview = 15;
	optional string title = 16;
	optional string file_description = 17;
	optional string short_description = 18;
	optional uint32 time_created = 19;
	optional uint32 time_updated = 20;
	optional uint32 visibility = 21;
	optional uint32 flags = 22;
	optional bool workshop_file = 23;
	optional bool workshop_accepted = 24;
	optional bool show_subscribe_all = 25;
	optional int32 num_comments_developer = 26;
	optional int32 num_comments_public = 27;
	optional bool banned = 28;
	optional string ban_reason = 29;
	optional fixed64 banner = 30;
	optional bool can_be_deleted = 31;
	optional bool incompatible = 32;
	optional string app_name = 33;
	optional uint32 file_type = 34;
	optional bool can_subscribe = 35;
	optional uint32 subscriptions = 36;
	optional uint32 favorited = 37;
	optional uint32 followers = 38;
	optional uint32 lifetime_subscriptions = 39;
	optional uint32 lifetime_favorited = 40;
	optional uint32 lifetime_followers = 41;
	optional uint32 views = 42;
	optional uint32 image_width = 43;
	optional uint32 image_height = 44;
	optional string image_url = 45;
	optional bool spoiler_tag = 46;
	optional uint32 shortcutid = 47;
	optional string shortcutname = 48;
	optional uint32 num_children = 49;
	optional uint32 num_reports = 50;
	repeated .PublishedFileDetails.Preview previews = 51;
	repeated .PublishedFileDetails.Tag tags = 52;
	repeated .PublishedFileDetails.Child children = 53;
	repeated .PublishedFileDetails.KVTag kvtags = 54;
	optional .PublishedFileDetails.VoteData vote_data = 55;
	optional uint32 time_subscribed = 56 [(description) = "Only valid in PublishedFile.GetUserFiles and not normal PublishedFile.GetDetail calls"];
}

message CPublishedFile_GetDetails_Response {
	repeated .PublishedFileDetails publishedfiledetails = 1;
}

message CPublishedFile_GetUserFiles_Request {
	optional uint32 appid = 1 [(description) = "App Id to retrieve published files from."];
	optional uint32 page = 3 [default = 1, (description) = "(Optional) Starting page for results."];
	optional uint32 numperpage = 4 [default = 1, (description) = "(Optional) The number of results, per page to return."];
	optional string sortmethod = 6 [default = "lastupdated", (description) = "(Optional) Sorting method to use on returned values."];
	optional bool totalonly = 7 [(description) = "(Optional) If true, only return the total number of files that satisfy this query."];
	optional uint32 privacy = 9 [(description) = "(optional) Filter by privacy settings."];
	optional bool ids_only = 10 [(description) = "(Optional) If true, only return the published file ids of files that satisfy this query."];
	repeated string requiredtags = 11 [(description) = "(Optional) Tags that must be present on a published file to satisfy the query."];
	repeated string excludedtags = 12 [(description) = "(Optional) Tags that must NOT be present on a published file to satisfy the query."];
}

message CPublishedFile_GetUserFiles_Response {
	message App {
		optional uint32 appid = 1;
		optional string name = 2;
		optional uint32 shortcutid = 3;
		optional bool private = 4;
	}

	optional uint32 total = 1;
	optional uint32 startindex = 2;
	repeated .PublishedFileDetails publishedfiledetails = 3;
	repeated .CPublishedFile_GetUserFiles_Response.App apps = 4;
}

message CPublishedFile_Update_Request {
	optional uint32 appid = 1 [(description) = "App Id this published file belongs to."];
	optional fixed64 publishedfileid = 2 [(description) = "Published file id of the file we'd like update."];
	optional string title = 3 [(description) = "(Optional) Title of the published file."];
	optional string file_description = 4 [(description) = "(Optional) Description of the published file."];
	optional uint32 visibility = 5 [(description) = "(Optional) Visibility of the published file."];
	repeated string tags = 6 [(description) = "(Optional) Set of tags for the published file."];
	optional string filename = 7 [(description) = "(Optional) Filename for the published file."];
	optional string preview_filename = 8 [(description) = "(Optional) Preview filename for the published file."];
}

message CPublishedFile_Update_Response {
}

message CPublishedFile_RefreshVotingQueue_Request {
	optional uint32 appid = 1;
	optional uint32 matching_file_type = 2 [(description) = "EPublishedFileInfoMatchingFileType"];
	repeated string tags = 3 [(description) = "Include files that have all the tags or any of the tags if match_all_tags is set to false."];
	optional bool match_all_tags = 4 [default = true, (description) = "If true, then files must have all the tags specified.  If false, then must have at least one of the tags specified."];
	repeated string excluded_tags = 5 [(description) = "Exclude any files that have any of these tags."];
	optional uint32 desired_queue_size = 6 [(description) = "Desired number of items in the voting queue.  May be clamped by the server"];
}

message CPublishedFile_RefreshVotingQueue_Response {
}

service PublishedFile {
	option (service_description) = "A service to access published file data";

	rpc Subscribe (.CPublishedFile_Subscribe_Request) returns (.CPublishedFile_Subscribe_Response) {
		option (method_description) = "Subscribes the user to the published file";
	}

	rpc Unsubscribe (.CPublishedFile_Unsubscribe_Request) returns (.CPublishedFile_Unsubscribe_Response) {
		option (method_description) = "Unsubscribes the user from the published file";
	}

	rpc Publish (.CPublishedFile_Publish_Request) returns (.CPublishedFile_Publish_Response) {
		option (method_description) = "Publishes a clouded user file to the Workshop.";
	}

	rpc GetDetails (.CPublishedFile_GetDetails_Request) returns (.CPublishedFile_GetDetails_Response) {
		option (method_description) = "Retrieves information about a set of published files.";
	}

	rpc GetUserFiles (.CPublishedFile_GetUserFiles_Request) returns (.CPublishedFile_GetUserFiles_Response) {
		option (method_description) = "Retrieves files published by a user.";
	}

	rpc Update (.CPublishedFile_Update_Request) returns (.CPublishedFile_Update_Response) {
		option (method_description) = "Updates information about a published file.";
	}

	rpc RefreshVotingQueue (.CPublishedFile_RefreshVotingQueue_Request) returns (.CPublishedFile_RefreshVotingQueue_Response) {
		option (method_description) = "Refresh the voting queue for the user";
	}
}
