import "steammessages_unified_base.steamworkssdk.proto";

message CPublishedFile_Subscribe_Request {
	optional uint64 publishedfileid = 1;
	optional uint64 steamid = 2;
	optional uint32 list_type = 3;
	optional int32 appid = 4;
	optional bool notify_client = 5;
}

message CPublishedFile_Subscribe_Response {
}

message CPublishedFile_Unsubscribe_Request {
	optional uint64 publishedfileid = 1;
	optional uint64 steamid = 2;
	optional uint32 list_type = 3;
	optional int32 appid = 4;
	optional bool notify_client = 5;
}

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 uint32 appid = 5;
}

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;
	}

	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 string file_url = 9;
	optional string preview_url = 10;
	optional string youtubevideoid = 11;
	optional string url = 12;
	optional fixed64 hcontent_file = 13;
	optional fixed64 hcontent_preview = 14;
	optional string title = 15;
	optional string file_description = 16;
	optional uint32 time_created = 17;
	optional uint32 time_updated = 18;
	optional uint32 visibility = 19;
	optional bool is_friend_of_owner = 20;
	optional uint32 flags = 21;
	optional bool workshop_file = 22;
	optional bool workshop_accepted = 23;
	optional bool show_subscribe_all = 24;
	optional int32 num_comments_developer = 25;
	optional int32 num_comments_public = 26;
	optional bool banned = 27;
	optional string ban_reason = 28;
	optional fixed64 banner = 29;
	optional bool can_be_deleted = 30;
	optional bool consumer_app_private = 31;
	optional bool incompatible = 32;
	optional string consumer_app_instructions_link = 33;
	optional string consumer_app_name = 34;
	optional uint32 file_type = 35;
	optional bool can_subscribe = 36;
	optional uint32 subscriptions = 37;
	optional uint32 favorited = 38;
	optional uint32 lifetime_subscriptions = 39;
	optional uint32 lifetime_favorited = 40;
	optional uint32 views = 41;
	optional uint32 image_width = 42;
	optional uint32 image_height = 43;
	optional bool spoiler_tag = 44;
	optional uint32 shortcutid = 45;
	optional string shortcutname = 46;
	optional string short_description = 47;
	optional string image_url = 48;
	optional string app_name = 49;
	optional uint32 time_subscribed = 50;
	repeated .PublishedFileDetails.Preview previews = 51;
	repeated .PublishedFileDetails.Tag tags = 52;
	repeated .PublishedFileDetails.Child children = 53;
	repeated .PublishedFileDetails.KVTag kvtags = 54;
}

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 {
}

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.";
	}
}
