syntax = "proto3";

package com.wixpress.appservice.api.upstream.wix.stores.product.restrictions.spi.v3;
option java_package = "com.wixpress.appservice.api.upstream.wix.stores.product.restrictions.spi.v3";

import "google/protobuf/wrappers.proto";
import "google/api/annotations.proto";
import "wix/api/annotations.proto";
import "wix/api/entity.proto";
import "wix/api/permissions.proto";
import "wix/api/validations.proto";
import "wix/spi/definitions.proto";
import "wix/common/spi.proto";

message ProductRestrictionsConfig {
  option (.wix.api.decomposite_of) = "wix.stores.product.restrictions.spi.v3.ProductRestrictionsConfig";
  // URI where the SPI Implementer is deployed
  .wix.common.spi.SpiBaseUri deployment_uri = 1;

  // Product restrictions configuration.
  RestrictionsConfig product_restrictions_config = 2;
}

message RestrictionsConfig{
  option (.wix.api.decomposite_of) = "wix.stores.product.restrictions.spi.v3.RestrictionsConfig";
  // Prices restrictions.
  //
  // Affected fields:
  // * `variantsInfo.variants.price.actualPrice.amount`
  // * `variantsInfo.variants.price.compareAtPrice.amount`
  // * `inventory.trackingMethod.quantity`
  Restriction prices = 1;

  // Options restrictions.
  //
  // Affected field: `options` (all nested fields except `linkedMedia`)
  Restriction options = 2;

  // Modifier restrictions.
  //
  // Affected field: `modifiers` (all nested fields except `linkedMedia`)
  Restriction modifiers = 3;

  // Inventory restrictions.
  //
  // Affected fields:
  // * `variantsInfo.variants.sku`
  // * `variantsInfo.variants.barcode`
  // * `inventory.trackingMethod.quantity`
  Restriction inventory = 4;

  // Pre order restrictions.
  //
  // Affected field: `inventory.preorderInfo`
  Restriction pre_order = 5;

  // Whether to disallow product duplication or display a warning when duplicating a product.
  Restriction duplicate_product = 6;
}


message Restriction {
  option (.wix.api.decomposite_of) = "wix.stores.product.restrictions.spi.v3.Restriction";
  // Restriction level.
  RestrictionLevel restriction_level = 1;

}


enum RestrictionLevel {
  UNKNOWN_RESTRICTION_TYPE = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED];
  // Users can edit the product field after acknowledging a warning modal.
  WARNING = 1;
  // Users **cannot** edit the product field.
  LOCKED = 2;
}



