syntax = "proto3";

package com.wixpress.appservice.api.pricing;

import "google/protobuf/wrappers.proto";
import "plans/plans_messages.proto";
import "features/features_messages.proto";
import "wix/api/validations.proto";

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

message PricingModel {
    repeated Plan plans = 1;
    repeated Feature features = 2;
    BusinessModel business_model = 3;
    google.protobuf.Int32Value free_trial_days = 4;
    bool is_external_pricing = 5;
    google.protobuf.StringValue external_pricing_page_url= 6;
    string language_code = 7; // todo: add format LANGUAGE when client is ready
    bool is_in_app_purchase = 8;
    bool is_required_wix_premium = 9;
    bool is_external_billing = 10;
    google.protobuf.Int32Value internal_free_trial_days = 11;
}

enum BusinessModel {
    None = 0;
    FREEMIUM = 1;
    PREMIUM = 2;
    FREE = 3;
    WIX_PREMIUM = 4;
    DYNAMIC = 5;
}

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

message CreatePricingModelResponse {
    string app_id = 1;
    string language_code = 2; // todo: add format LANGUAGE when client is ready
    PricingModel model = 3;
}

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

message UpdatePricingModelResponse {
    PricingModel model = 1;
}

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

message GetPricingModelResponse {
    string app_id = 1;
    string language_code = 2; // todo: add format LANGUAGE when client is ready
    PricingModel model = 3;
}

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

message DeletePricingModelResponse {
    string app_id = 1;
    string language_code = 2; // todo: add format LANGUAGE when client is ready
}

message PricingModelChangedEvent {
    string app_id = 1 [(wix.api.format) = GUID];
    string language_code = 2; // todo: add format LANGUAGE when client is ready
    PricingModel model = 3;
    Action action = 4;

    enum Action {
        CREATED = 0;
        UPDATED = 1;
        RESTORED = 2;
        DELETED = 3;
    }
}

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

message GetVendorProductsResponse {
    repeated string vendor_products = 1 [(wix.api.maxSize) = 100, (wix.api.maxLength) = 24];
}

message ForcePricingModelTranslationForRequest {
    repeated string app_ids = 1 [(wix.api.format) = GUID, (wix.api.maxSize) = 100];
}

message ForcePricingModelTranslationForResponse {}