syntax = "proto3";

package com.wix.ecommerce.catalog_spi.api.v1;

import "google/protobuf/wrappers.proto";
import "wix/api/annotations.proto";
import "wix/api/validations.proto";
import "wix/common/pageurl.proto";
import "com/wix/ecommerce/platform_common/api/taxable_address.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/description_line.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/subscription_option_info.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/item_type.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/policy.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/item_media.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/physical_properties.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/product_name.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/secured_media.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/payment_option.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/service_properties.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/price_description.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/additional_fee.proto";
import "wix/coupons/api/v2/scope.proto";
import "com/wix/ecommerce/catalog_spi/api/v1/modifier_group.proto";

message ItemData {

    /*
    __Required.__ Item name.
    */
    ProductName product_name = 1;

    // URL for the item's page on the site.
    //
    // This is used to link back to the relevant item page from the cart page. If not provided, the site URL is used.
    .wix.common.PageUrlV2 url = 2;

    // __Required.__ Item type. Either one of the preset types or a custom type.
    ItemType item_type = 11;

    // __Required.__ Item price with discounts applied. If a catalog-defined discount applies, the discount is reflected in this price.
    string price = 3 [(.wix.api.decimalValue) = { gte: "0" lte: "1000000000000000"}];

    // Item price **before** applying any catalog-defined discount.
    //
    // Default: Value of `price` field, if no catalog-defined discount applies.
    google.protobuf.StringValue full_price = 5 [(.wix.api.format) = DECIMAL_VALUE];

    // The tax group ID associated with this item. Learn more about the [Tax Groups Service Plugin](https://dev.wix.com/docs/rest/business-solutions/e-commerce/service-plugins/tax-groups-integration-service-plugin/introduction).
    google.protobuf.StringValue tax_group_id = 4 [(.wix.api.format) = GUID];

    // Line item description lines. Used for displaying the item in a cart, checkout or order. For example, if you want `Size: Large` to appear under the item name, create a description line with `"name": {"original": "Size"}` and  `"plainText": {"original": "Large"}`.
    //
    // Default: No description line.
    repeated DescriptionLine description_lines = 6 [(.wix.api.minSize) = 0, (.wix.api.maxSize) = 20];

    // Line item image details. Supports images from the [Wix Media Manager](https://support.wix.com/en/article/wix-media-accessing-the-media-manager) only.
    //
    // To use an image from another source, first upload it to the Media Manager.
    // You can retrieve the ID, width and height of an image from the Wix Media Manager.
    Image media = 7;

    // Quantity of the item available for purchase. Only return if the catalog manages inventory.
    // If not returned, a buyer can increase the quantity of this item to add to the cart or checkout without limit.
    google.protobuf.Int32Value quantity_available = 8 [(.wix.api.min) = 0, (.wix.api.max) = 100000000];

    // Physical properties of the item. Only return for physical items. When applicable, contains information such as SKU and item weight.
    PhysicalProperties physical_properties = 9;

    // Coupon scopes. These specify which app and items a coupon applies to.
    // Should be used by Bookings, Stores, and Events in line with the current [Coupons API](https://bo.wix.com/wix-docs/rest/stores/coupons/valid-scope-values).
    repeated .wix.coupons.api.v2.Scope coupon_scopes = 10 [(.wix.api.field_exposure) = INTERNAL];

    // Subscription option info.
    SubscriptionOptionInfo subscription_option_info = 12 [(.wix.api.field_maturity) = BETA];

    // ID of the fulfiller for this item. This field is internal and only used by Stores.
    google.protobuf.StringValue fulfiller_id = 13 [(.wix.api.referenced_entity) = "wix.ecom.v1.fulfiller", (.wix.api.field_exposure) = INTERNAL, (.wix.api.format) = GUID];

    // Digital file details. Required if `itemType.preset` is `DIGITAL`.
    SecuredMedia digital_file = 14 [(.wix.api.field_exposure) = INTERNAL];

    // Shipping group ID. This field is internal and only used by Stores.
    google.protobuf.StringValue shipping_group_id = 15 [(.wix.api.field_exposure) = PRIVATE, (.wix.api.format) = GUID, (.wix.api.readOnly) = true];

    // Type of selected payment option for current item.
    //
    // Default: `FULL_PAYMENT_ONLINE`
    PaymentOptionType payment_option = 17;

    // Service properties. When applicable, this contains information such as time and number of participants.
    ServiceProperties service_properties = 18;

    // Additional ID for the item in the catalog.
    // This field provides an additional identifier for the item if your flow requires another ID as well as `catalogReference.catalogItemId`.
    // Can be used for membership validation.
    //
    // Default: Same as `catalogReference.catalogItemId`.
    google.protobuf.StringValue root_catalog_item_id = 19 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 36];

    // Additional description for the price. Return when additional information about the price is needed.
    //
    // For example, when `price` is `"0"` but additional details about the actual price are needed, such as `"Starts at $67"`.
    PriceDescription price_description = 20;


    // Partial payment to be paid upfront during the checkout. Return when `paymentOption` is `DEPOSIT_ONLINE`.
    //
    // Default: If `paymentOption` is `DEPOSIT_ONLINE` but `depositAmount` is not provided, the item is treated as if `paymentOption` is `FULL_PAYMENT_ONLINE`.
    google.protobuf.StringValue deposit_amount = 21 [(.wix.api.format) = DECIMAL_VALUE];

    // Delivery profile ID for the product.
    google.protobuf.StringValue delivery_profile_id = 22 [(.wix.api.format) = GUID, (.wix.api.field_exposure) = INTERNAL];

    // Item payment policy that requires customer consent to complete purchase. The payment policy will be displayed on the checkout page.
    google.protobuf.StringValue consent_required_payment_policy = 23 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 2500, (.wix.api.field_maturity) = BETA];

    // Whether the price is not yet defined, and will be updated after the order is created.
    //
    // Default: `false`
    bool price_undetermined = 24 [(.wix.api.field_maturity) = BETA];

    // Whether the line item quantity is fixed and cannot be changed.
    //
    // Default: `false`
    bool fixed_quantity = 25 [(.wix.api.field_maturity) = BETA];

    // Whether to save the payment method on the order.
    //
    // Default: `false`
    bool save_payment_method = 26 [(.wix.api.field_maturity) = BETA];

    // Address to use for tax calculation purposes.
    .com.wix.ecommerce.platform_common.api.TaxableAddress taxable_address = 27 [(.wix.api.field_maturity) = BETA];

    // ID of the app managing the inventory.
    google.protobuf.StringValue inventory_app_id = 28 [(.wix.api.format) = GUID, (.wix.api.field_maturity) = ALPHA];

    // Policies to be displayed to the customer on the checkout page.
    repeated Policy policies = 29 [(.wix.api.field_maturity) = BETA, (.wix.api.maxSize) = 5];    
    
    // Additional Fees to be added to this item calculation.
    repeated AdditionalFee additional_fees = 30 [(.wix.api.field_maturity) = BETA, (.wix.api.maxSize) = 5];

    // Whether the item can only be purchased by site members.
    //
    // Default: `false`
    bool members_only = 31 [(.wix.api.field_maturity) = BETA];

    // Modifier groups that were added to the item.
    repeated ModifierGroup modifier_groups = 32 [(.wix.api.field_maturity) = BETA, (.wix.api.maxSize) = 25];
};
