// flynt-disable field-lower-snake-case
// flynt-disable missing-array-limits
// flynt-disable missing-field-comments
// flynt-disable missing-string-validations
syntax = "proto3";

package wix.coupons.api.v1;

import "google/protobuf/wrappers.proto";

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

message Specification {
    // coupons data

    google.protobuf.StringValue name = 2; // friendly name for display. up to 80 characters
    google.protobuf.StringValue code = 3; // the code by which the end user is applying the coupon. up to 20 characters. must be unique
    google.protobuf.Int64Value startTime = 4; // what time to start using this coupon. in milliseconds. mandatory
    google.protobuf.Int64Value expirationTime = 5; // when will this coupon expire. in milliseconds. optional
    google.protobuf.Int32Value usageLimit = 6; // what is the usage limit. if not supplied then it is unlimited by number
    google.protobuf.BoolValue perItem = 7; // coupon is applied for each item in scope. the default is applied once
    google.protobuf.BoolValue active = 8; // the coupon in active state. inactive coupon will be ignored when applied
                                          // if not passed - the default is active
    google.protobuf.DoubleValue minimumSubtotal = 9; // limit the coupon to carts which their subtotal is above this number
    repeated string scopes = 10; // if scopes is empty - the coupon is applied on the whole cart
                                 // otherwise the calculation is matching the line item scopes against the coupon scope

    // coupon type and information according to its type
    // the coupon type is mandatory and must be passed on creation
    message BuyXGetY { int32 x = 1; int32 y = 2; }
    oneof Behavior {
        double moneyOffAmount = 11; // discount by amount
        double percentOffRate = 12; // discount by percentage rate
        bool freeShipping = 13; // free shipping
        double fixedPriceAmount = 14; // the price of the
        BuyXGetY buyXGetY = 15;
    }
}



