// flynt-disable missing-array-limits
// flynt-disable missing-field-comments
// flynt-disable missing-string-validations
// flynt-disable missing-version-in-rest-path-url
// flynt-disable request-response
syntax = "proto3";

package wix.coupons.api.v2;

import "google/api/annotations.proto";
import "wix/api/annotations.proto";
import "google/protobuf/wrappers.proto";
import "wix/coupons/api/v2/item-for-coupon.proto";

option java_package = "com.wix.coupons.api.v2";


service CouponsManagerUI {
    option (wix.api.service_exposure) = PRIVATE;

    rpc GetAllScopeConfigs (AllScopeConfigsRequest) returns (AllScopeConfigsResponse) {
        option (google.api.http) = {
            get: "/api/v2/coupons-scope-configs"
        };
    }

    rpc GetItem (GetItemRequest) returns (GetItemResponse) {
        option (google.api.http) = {
            get: "/api/v2/items/{itemId}"
        };
    }

    rpc GetItems (GetItemsRequest) returns (GetItemsResponse) {
        option (google.api.http) = {
            get: "/api/v2/items"
        };
    }

    rpc GetShoutoutAdditionalItems (GetShoutoutAdditionalItemsRequest) returns (GetItemsResponse) {
        option (google.api.http) = {
            get: "/api/v2/shoutout-addtional-items/{couponId}"
        };
    }
}

message AllScopeConfigsRequest {
}

message AllScopeConfigsResponse {
    repeated string supported_coupon_types = 1; // coupon types from all scopes
    repeated ScopeConfig scope_configs = 2; // scopeConfigs from all verticals
}

message ScopeConfig {
    string namespace = 1; // stores / bookings / events
    google.protobuf.StringValue group = 2; // group - optional
    string display_name = 3; // name in drop down
    string type = 4; // "SCOPE"/"MINSUBTOTAL"/"DEFAULT"
    InputDataConfig input_data_config = 5; // right drop down data - optional
    LimitedToOneItemConfig limited_to_one_item = 6;
    LimitPerCustomerConfig limit_per_customer = 8;
    SubscriptionConfig subscription_config = 9;
    DiscountedCycleCountConfig discounted_cycle_count = 10;
    repeated string supported_coupon_types = 7;
}

message InputDataConfig {
    string label = 1;
    string placeholder = 2;
    bool should_show_media = 3;
}

message LimitedToOneItemConfig {
    bool visible = 1;
    bool default = 2;
}

message SubscriptionConfig {
    bool visible = 1;
    bool default = 2;
}

message DiscountedCycleCountConfig {
    bool visible = 1;
    google.protobuf.Int32Value default = 2;
}

message LimitPerCustomerConfig {
    bool visible = 1;
    int32 default = 2;
}

message GetItemsRequest {
    string namespace = 1;
    string group = 2;
    int32 limit = 3;
    int32 offset = 4;
    google.protobuf.StringValue text = 5;
}

message GetShoutoutAdditionalItemsRequest {
    string coupon_id = 1;
}

message GetItemsResponse {
    repeated ItemForCoupon items = 1;
    int32 total_count = 2;
}

message GetItemRequest {
    string item_id = 1;
    string namespace = 2;
    string group = 3;

}

message GetItemResponse {
    ItemForCoupon item = 1;
}
