syntax = "proto3";

package com.wixpress.appservice.api.pricing;

import "google/protobuf/wrappers.proto";
import "wix/api/validations.proto";

option java_package = "com.wixpress.appservice.api.pricing";

message Plan {
    google.protobuf.StringValue id = 1; //plan id
    google.protobuf.StringValue name = 2; // plan name
    map<string,string> feature_list = 3; // list of feature for the package picker
    Billing billing = 4;
    bool most_popular = 5; // market this plan as most popular
    google.protobuf.StringValue vendor_id = 6; // the vendor_id to create in premium
    repeated string benefits = 7; // benefits of the plan, one option to plan description enum
    PlanStatus status = 8; // plan status emum
    bool is_free = 9; // mark this plan as free
    PlanDescription plan_description  = 10;// enum what to use as plan description
    google.protobuf.StringValue custom_text = 11; // text to define the plan one option to plan description enum
}

enum PlanDescription {
    UNKNOWN_DESCRIPTION = 0;
    BENEFITS = 1; // indicate that the description will be list of benefits
    CUSTOM_TEXT = 2;// indicate that the description will custom_text field
}

enum PlanStatus {
    UNKNOWN = 0;
    VISIBLE = 1; // show this plan on app market
    HIDDEN = 2; // hide this plan
}

message Billing {
    double monthly_price = 1; // the monthly cost of this plan
    double yearly_price = 2; // the yearly cost of this plan
    int32 yearly_discount_percent = 3; // the yearly discount percent of this plan
    double one_time_price = 4; // the one time price of this plan
    google.protobuf.StringValue custom_title = 5; // custom title of this plan which replace the price
    MeteredBilling metered_billing = 6; // billing plan in which customers are charged for their usage during a cycle period
}

message MeteredBilling {
    double monthly_base_fee = 1; // price to be presented to the user as the base fee
    google.protobuf.DoubleValue additional_charges = 2; // additional charges set by the developer
    google.protobuf.StringValue checkout_additional_info = 3; // allows the developer to explain his pricing terms in a user-friendly way
}

message CreatePlanRequest {
    string app_id = 1 [(wix.api.format) = GUID];
    string language_code = 3; // todo: add format LANGUAGE when client is ready
    Plan plan = 2;
}

message CreatePlanResponse {
    string plan_id = 1;
    Plan plan = 2;
}

message UpdatePlanRequest {
    string app_id = 1 [(wix.api.format) = GUID];
    string language_code = 2; // todo: add format LANGUAGE when client is ready
    string plan_id = 3 [(wix.api.format) = GUID];
    Plan plan = 4;
}
message UpdatePlanResponse {
    Plan plan = 1;
}

message GetPlanRequest {
    string app_id = 1 [(wix.api.format) = GUID];
    string language_code = 2; // todo: add format LANGUAGE when client is ready
    string plan_id = 3 [(wix.api.format) = GUID];
}

message GetPlanResponse {
    Plan plan = 1;
}

message DeletePlanRequest {
    string app_id = 1 [(wix.api.format) = GUID];
    string language_code = 2; // todo: add format LANGUAGE when client is ready
    string plan_id = 3 [(wix.api.format) = GUID];
}

message DeletePlanResponse {
    string plan_id = 1;
}

message UpdatePlanTranslationWithRequest {
    map<string, string> translation_data = 1;
    string app_id = 2 [(wix.api.format) = GUID];
    string plan_id = 3 [(wix.api.format) = GUID];
    string language_code = 4 [(wix.api.format) = LANGUAGE];
}

message UpdatePlanTranslationWithResponse {}

message PlansAndFeaturesForRequest {
    string app_id = 1 [(wix.api.format) = GUID];
}

message PlansAndFeaturesForResponse {
    repeated string plan_ids = 1 [(wix.api.format) = GUID, (wix.api.maxSize) = 100];
    repeated string feature_ids = 2 [(wix.api.format) = GUID, (wix.api.maxSize) = 100];
}