import "common_base.proto";

message CPromotionNotificationResults {
	optional fixed64 notification_id = 1;
	optional fixed64 tracking_id = 2;
	optional string email_address = 3;
	optional uint32 accountid = 4;
	optional uint32 status = 5;
	optional int32 type = 6 [(.description) = "enum"];
	optional uint32 rt_send_time = 7;
}

message CPromotionPlan {
	optional fixed64 promotion_id = 1;
	optional string admin_jsondata = 2;
	optional string partner_jsondata = 3;
	optional string input_jsondata = 4;
	optional uint32 rtime32_start_time = 5;
	optional uint32 rtime32_end_time = 6;
	optional uint32 partner_id = 7;
	optional string input_access_key = 8;
	optional uint32 last_update_time = 9;
	optional string partner_readonly_jsondata = 10;
	optional string partner_writable_jsondata = 11;
	optional string assets_readonly_jsondata = 12;
	optional string assets_writable_jsondata = 13;
}

message CPromotionPlan_CreateSalePageForPromo_Request {
	optional uint32 clan_account_id = 1;
	optional fixed64 clan_event_gid = 2;
	optional uint32 rtime_sale_start = 3;
	optional uint32 rtime_sale_end = 4;
	optional fixed64 daily_deal_gid = 5;
	optional fixed64 promotion_gid = 6;
	optional bool create_asset_request = 7;
	optional uint32 partner_id = 8;
	optional uint32 advertising_appid = 9;
}

message CPromotionPlan_CreateSalePageForPromo_Response {
	optional uint32 clan_account_id = 1;
	optional fixed64 clan_event_gid = 2;
	optional fixed64 daily_deal_gid = 3;
	optional fixed64 promotion_gid = 4;
	optional fixed64 asset_request_gid = 5;
	optional uint32 advertising_appid = 6;
}

message CPromotionPlanning_CreatePlan_Request {
	optional .CPromotionPlan plan = 1;
}

message CPromotionPlanning_CreatePlan_Response {
	optional fixed64 promotion_id = 1;
	optional string input_access_key = 2;
}

message CPromotionPlanning_DeletePlan_Request {
	optional fixed64 promotion_id = 1;
}

message CPromotionPlanning_DeletePlan_Response {
}

message CPromotionPlanning_GetAllActivePlan_Request {
}

message CPromotionPlanning_GetAllActivePlan_Response {
	repeated .CPromotionPlan plan = 1;
}

message CPromotionPlanning_GetAllPlansForApps_Request {
	repeated uint32 appids = 1;
	optional bool exclude_sales = 2;
	optional bool exclude_direct_featuring = 3;
}

message CPromotionPlanning_GetAllPlansForApps_Response {
	repeated .CPromotionPlan plans = 1;
	repeated .CPromotionPlanning_GetAllPlansForApps_Response_CAppIncludedInSales apps_included_in_sales = 2;
}

message CPromotionPlanning_GetAllPlansForApps_Response_CAppIncludedInSales {
	repeated uint32 appids = 1;
	optional fixed64 clan_event_gid = 2;
}

message CPromotionPlanning_GetAllPlansForPartner_Request {
	optional uint32 partnerid = 1;
	optional bool show_hidden = 4;
	optional uint32 start_date = 5;
	optional uint32 end_date = 6;
}

message CPromotionPlanning_GetAllPlansForPartner_Response {
	repeated .CPromotionPlan plans = 1;
}

message CPromotionPlanning_GetPlan_Request {
	optional fixed64 promotion_id = 1;
}

message CPromotionPlanning_GetPlan_Response {
	optional .CPromotionPlan plan = 1;
}

message CPromotionPlanning_GetPlanByInputAccessKey_Request {
	optional string input_access_key = 1;
}

message CPromotionPlanning_GetPlanByInputAccessKey_Response {
	optional .CPromotionPlan plan = 1;
}

message CPromotionPlanning_GetPlanCompletedInDateRange_Request {
	optional uint32 oldest_rtime = 1;
	optional uint32 newest_rtime = 2;
	repeated string promotion_types = 3;
}

message CPromotionPlanning_GetPlanCompletedInDateRange_Response {
	repeated .CPromotionPlan plans = 1;
}

message CPromotionPlanning_GetPlansUpdatedSince_Request {
	optional uint32 rtime = 1;
	optional uint32 upto_rtime = 2;
}

message CPromotionPlanning_GetPlansUpdatedSince_Response {
	repeated .CPromotionPlan plans = 1;
	repeated fixed64 deleted_plan_ids = 2;
}

message CPromotionPlanning_GetPromotionPlanForSalePages_Request {
	repeated .CPromotionPlanning_GetPromotionPlanForSalePages_Request_CSalePage request_list = 1;
}

message CPromotionPlanning_GetPromotionPlanForSalePages_Request_CSalePage {
	optional uint32 clan_account_id = 1;
	optional fixed64 gid_clan_event = 2;
}

message CPromotionPlanning_GetPromotionPlanForSalePages_Response {
	repeated .CPromotionPlan plans = 1;
}

message CPromotionPlanning_GetPromotionPlanPackageSales_Request {
	optional uint64 promotion_id = 1;
	optional uint32 partnerid = 2;
}

message CPromotionPlanning_GetPromotionPlanPackageSales_Response {
	repeated .CPromotionPlanning_GetPromotionPlanPackageSales_Response_PromotionPlanPackageSalesDetails promo_plan_package_sales_details = 1;
}

message CPromotionPlanning_GetPromotionPlanPackageSales_Response_PromotionPlanPackageSalesDetails {
	optional string date = 1;
	optional uint32 packageid = 2;
	optional int32 gross_units_sold = 3;
	optional int64 gross_sales_usdx100 = 4;
}

message CPromotionPlanning_GetPromotionPlanSummarySales_Request {
	optional uint32 num_weeks = 1;
	repeated string promotion_types = 2;
}

message CPromotionPlanning_GetPromotionPlanSummarySales_Response {
	repeated .CPromotionPlanning_GetPromotionPlanSummarySales_Response_CSummaryResults results = 1;
}

message CPromotionPlanning_GetPromotionPlanSummarySales_Response_CSummaryResults {
	optional string promotion_type = 1;
	optional int64 gross_sales_minimum_usdx100 = 2;
	optional int64 gross_sales_median_usdx100 = 3;
	optional int64 gross_sales_average_usdx100 = 4;
	optional int64 gross_sales_maximum_usdx100 = 5;
	optional int32 num_weeks = 6;
}

message CPromotionPlanning_GetSalePageCandidatesForPromo_Request {
	optional uint32 account_id = 1;
	optional bool include_published = 2;
}

message CPromotionPlanning_GetSalePageCandidatesForPromo_Response {
	repeated .CPromotionPlanning_GetSalePageCandidatesForPromo_Response_clan clans = 1;
}

message CPromotionPlanning_GetSalePageCandidatesForPromo_Response_clan {
	optional uint32 clan_account_id = 1;
	optional string clan_name = 2;
	optional bool is_creator_home = 3;
	repeated .CPromotionPlanning_GetSalePageCandidatesForPromo_Response_salepage sale_pages = 4;
}

message CPromotionPlanning_GetSalePageCandidatesForPromo_Response_salepage {
	optional uint32 clan_account_id = 1;
	optional fixed64 gid_clan_event = 2;
	optional string name = 3;
	optional bool published = 4;
	optional uint32 start_time = 5;
	optional uint32 end_time = 6;
}

message CPromotionPlanning_GetSentNotification_Request {
	optional fixed64 promotion_id = 1;
	optional fixed64 notification_id = 2;
}

message CPromotionPlanning_GetSentNotification_Response {
	repeated .CPromotionNotificationResults results = 1;
}

message CPromotionPlanning_GetUpcomingScheduledDiscounts_Request {
	optional uint32 rtstart = 1;
	optional uint32 rtend = 2;
	optional bool include_packages = 3;
	optional bool filter_modified_sales_rank = 4 [default = true];
}

message CPromotionPlanning_GetUpcomingScheduledDiscounts_Response {
	repeated .CPromotionPlanning_GetUpcomingScheduledDiscounts_Response_CUpcomingPackageDiscountInfo package_details = 1;
	repeated .CPromotionPlanning_GetUpcomingScheduledDiscounts_Response_CUpcomingAppDiscountInfo app_details = 2;
}

message CPromotionPlanning_GetUpcomingScheduledDiscounts_Response_CUpcomingAppDiscountInfo {
	optional uint32 appid = 1;
	optional uint32 cheapest_package_id = 3;
	optional uint32 cheapest_discount_id = 4;
	optional string cheapest_discount_name = 5;
	optional uint32 package_original_price_usd = 6;
	optional uint32 discounted_price_usd = 7;
	optional uint32 discount_percentage = 8;
	optional uint32 rtime_discount_start = 9;
	optional uint32 rtime_discount_end = 10;
	optional uint32 num_discounted_packages = 11;
	optional uint32 modified_sales_rank = 12;
}

message CPromotionPlanning_GetUpcomingScheduledDiscounts_Response_CUpcomingPackageDiscountInfo {
	optional uint32 package_id = 1;
	optional uint32 discount_id = 2;
	optional string discount_name = 3;
	optional uint32 discount_percentage = 4;
	optional uint32 original_price_usd = 5;
	optional uint32 discount_price_usd = 6;
	optional uint32 rtime_discount_start = 7;
	optional uint32 rtime_discount_end = 8;
}

message CPromotionPlanning_MarkLocalizationAssetComplete_Request {
	optional fixed64 promotion_id = 1;
	optional bool value = 2;
}

message CPromotionPlanning_MarkLocalizationAssetComplete_Response {
}

message CPromotionPlanning_ResendNotification_Request {
	optional fixed64 promotion_id = 1;
	optional fixed64 notification_id = 2;
}

message CPromotionPlanning_ResendNotification_Response {
}

message CPromotionPlanning_SearchPlan_Request {
	optional string token = 1;
}

message CPromotionPlanning_SearchPlan_Response {
	repeated .CPromotionPlan plan = 1;
}

message CPromotionPlanning_SendNotification_Request {
	optional fixed64 promotion_id = 1;
	optional int32 notification_type = 2 [(.description) = "enum"];
	optional bool only_explicit_email_addresses = 3;
}

message CPromotionPlanning_SendNotification_Response {
}

message CPromotionPlanning_SetPromotionEmailTarget_Request {
	optional fixed64 promotion_id = 1;
	optional bool add = 2;
	optional string email_address = 3;
}

message CPromotionPlanning_SetPromotionEmailTarget_Response {
}

message CPromotionPlanning_UpdatePlan_Request {
	optional .CPromotionPlan plan = 1;
	optional fixed64 promotion_id = 2;
}

message CPromotionPlanning_UpdatePlan_Response {
}

service PromotionPlanning {
	rpc CreatePlan (.CPromotionPlanning_CreatePlan_Request) returns (.CPromotionPlanning_CreatePlan_Response);
	rpc CreateSalePageForPromo (.CPromotionPlan_CreateSalePageForPromo_Request) returns (.CPromotionPlan_CreateSalePageForPromo_Response);
	rpc CreateTentativePlan (.CPromotionPlanning_CreatePlan_Request) returns (.CPromotionPlanning_CreatePlan_Response);
	rpc DeletePlan (.CPromotionPlanning_DeletePlan_Request) returns (.CPromotionPlanning_DeletePlan_Response);
	rpc GetAllActivePlan (.CPromotionPlanning_GetAllActivePlan_Request) returns (.CPromotionPlanning_GetAllActivePlan_Response);
	rpc GetAllPlansForApps (.CPromotionPlanning_GetAllPlansForApps_Request) returns (.CPromotionPlanning_GetAllPlansForApps_Response);
	rpc GetAllPlansForPartner (.CPromotionPlanning_GetAllPlansForPartner_Request) returns (.CPromotionPlanning_GetAllPlansForPartner_Response);
	rpc GetPlan (.CPromotionPlanning_GetPlan_Request) returns (.CPromotionPlanning_GetPlan_Response);
	rpc GetPlanByInputAccessKey (.CPromotionPlanning_GetPlanByInputAccessKey_Request) returns (.CPromotionPlanning_GetPlanByInputAccessKey_Response);
	rpc GetPlanCompletedInDateRange (.CPromotionPlanning_GetPlanCompletedInDateRange_Request) returns (.CPromotionPlanning_GetPlanCompletedInDateRange_Response);
	rpc GetPlansUpdatedSince (.CPromotionPlanning_GetPlansUpdatedSince_Request) returns (.CPromotionPlanning_GetPlansUpdatedSince_Response);
	rpc GetPromotionPlanForSalePages (.CPromotionPlanning_GetPromotionPlanForSalePages_Request) returns (.CPromotionPlanning_GetPromotionPlanForSalePages_Response);
	rpc GetPromotionPlanPackageSales (.CPromotionPlanning_GetPromotionPlanPackageSales_Request) returns (.CPromotionPlanning_GetPromotionPlanPackageSales_Response);
	rpc GetPromotionPlanSummarySales (.CPromotionPlanning_GetPromotionPlanSummarySales_Request) returns (.CPromotionPlanning_GetPromotionPlanSummarySales_Response);
	rpc GetSalePageCandidatesForPromo (.CPromotionPlanning_GetSalePageCandidatesForPromo_Request) returns (.CPromotionPlanning_GetSalePageCandidatesForPromo_Response);
	rpc GetSentNotification (.CPromotionPlanning_GetSentNotification_Request) returns (.CPromotionPlanning_GetSentNotification_Response);
	rpc GetUpcomingScheduledDiscounts (.CPromotionPlanning_GetUpcomingScheduledDiscounts_Request) returns (.CPromotionPlanning_GetUpcomingScheduledDiscounts_Response);
	rpc MarkLocalizationAssetComplete (.CPromotionPlanning_MarkLocalizationAssetComplete_Request) returns (.CPromotionPlanning_MarkLocalizationAssetComplete_Response);
	rpc ResendNotification (.CPromotionPlanning_ResendNotification_Request) returns (.CPromotionPlanning_ResendNotification_Response);
	rpc SearchPlan (.CPromotionPlanning_SearchPlan_Request) returns (.CPromotionPlanning_SearchPlan_Response);
	rpc SendNotification (.CPromotionPlanning_SendNotification_Request) returns (.CPromotionPlanning_SendNotification_Response);
	rpc SetPromotionEmailTarget (.CPromotionPlanning_SetPromotionEmailTarget_Request) returns (.CPromotionPlanning_SetPromotionEmailTarget_Response);
	rpc UpdatePlan (.CPromotionPlanning_UpdatePlan_Request) returns (.CPromotionPlanning_UpdatePlan_Response);
	rpc UpdatePlanInputData (.CPromotionPlanning_UpdatePlan_Request) returns (.CPromotionPlanning_UpdatePlan_Response);
	rpc UpdatePlanPartnerInfo (.CPromotionPlanning_UpdatePlan_Request) returns (.CPromotionPlanning_UpdatePlan_Response);
}

