syntax = "proto3";

// flynt-disable package-matches-structure
package com.wixpress.appservice.api.upstream.wix.restaurants.pos.spi.v1;
option java_package = "com.wixpress.appservice.api.upstream.wix.restaurants.pos.spi.v1";

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

message PosProviderSettingsServicePluginConfig {
    option (.wix.api.decomposite_of) = "wix.restaurants.pos.spi.v1.PosProviderSettingsServicePluginConfig";
  // URI where the SPI Implementer is deployed
  .wix.common.spi.SpiBaseUri deployment_uri = 1;

  //display name
  google.protobuf.StringValue display_name = 2 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 100];

  // Configuration specifying which fields of each menu-related entity
  // are managed by the POS and therefore disabled in the Wix UI.
  // Only fields listed here are considered disabled; all others remain editable in Wix.
  ManagedMenuEntities managed_menu_entities = 3;
}

message ManagedMenuEntities {
    option (.wix.api.decomposite_of) = "wix.restaurants.pos.spi.v1.ManagedMenuEntities";
  // menu override config
  FieldManagementConfig menu = 1;
  // section override config
  FieldManagementConfig section = 2;
  // item override config
  FieldManagementConfig item = 3;
  // modifier group override config
  FieldManagementConfig modifier_group = 4;
  // modifier override config
  FieldManagementConfig modifier = 5;
  // variant override config
  FieldManagementConfig variant = 6;
  // label override config
  FieldManagementConfig label = 7;
}

// Configuration for disabling entity fields in Wix UI (i.e., fields managed by the POS).
message FieldManagementConfig {
    option (.wix.api.decomposite_of) = "wix.restaurants.pos.spi.v1.FieldManagementConfig";
  // Fields that are fully managed by the provider.
  // Applies to all field types — scalar, message, and repeated.
  // If a repeated field is listed here, the entire list and its nested content are disabled in Wix UI.
  repeated string disabled_fields = 1 [(.wix.api.maxSize) = 100, (.wix.api.maxLength) = 100];

  // Advanced configuration for repeated fields.
  // Use to customize add/remove or reorder behavior.
  // The key is the **path to the repeated field**, and the value is config for list-level behavior.
  // Can be used even if the field is in `disabled_fields`.
  map<string, RepeatedFieldOverrideConfig> field_configs = 2;
}

// Controls list-level behavior for repeated fields.
message RepeatedFieldOverrideConfig {
    option (.wix.api.decomposite_of) = "wix.restaurants.pos.spi.v1.RepeatedFieldOverrideConfig";
  // If false, disables adding or removing elements in the repeated field.
  google.protobuf.BoolValue add_or_remove_enabled = 1;

  // If true, allows users to reorder elements in the Wix UI (even if add/remove is disabled).
  google.protobuf.BoolValue reorder_enabled = 2;
}
