syntax = "proto3";

package wix.catalog.api.v1;

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

option java_package = "com.wix.ecommerce.catalog.api.v1";

message PriceData {
    // Product price currency
    string currency = 1 [(wix.api.readOnly) = true];
    // Product price
    google.protobuf.DoubleValue price = 2 [(wix.api.min) = 0, (wix.api.max) = 999999999.99];
    // Discounted product price (if no discounted price is set, the product price is returned)
    double discounted_price = 3 [(wix.api.readOnly) = true];
    // The product price and discounted price, formatted with the currency
    FormattedPrice formatted = 4 [(wix.api.readOnly) = true];
    // Price per unit
    google.protobuf.DoubleValue price_per_unit = 5 [(wix.api.readOnly) = true];
}

message PriceDataV2 {
    // Product price currency
    Currency currency = 1 [(wix.api.readOnly) = true];
    // Product price
    double price = 2 [(wix.api.min) = 0, (wix.api.max) = 999999999.99];
    // Discounted product price (if no discounted price is set, the product price is returned)
    double discounted_price = 3 [(wix.api.readOnly) = true];
    // The product price and discounted price, formatted with the currency
    FormattedPrice formatted = 4 [(wix.api.readOnly) = true];
}

message FormattedPrice {
    // Product price formatted with the currency
    string price = 1;
    // Discounted product price formatted with the currency (if no discounted price is set, the product formatted price is returned)
    string discounted_price = 2;
    // Price per unit
    google.protobuf.StringValue price_per_unit = 3 [(wix.api.readOnly) = true];
}

message Discount {
    enum DiscountType {
        UNDEFINED = 0;
        // No discount
        NONE = 1;
        // Discount by a fixed amount
        AMOUNT = 2;
        // Discount by a percentage
        PERCENT = 3;
    }

    /* 
    Discount type:  
    + `"AMOUNT"`  
    + `"PERCENT"`
    */
    DiscountType type = 1;
    // Discount value
    double value = 2;
}

message Currency {
    string currency = 1;
    string symbol = 2;
}