syntax = "proto3";

package com.wixpress.appservice.api.upstream.wix.forms.v4;

import "wix/api/validations.proto";
import "wix/spi/definitions.proto";
import "google/api/annotations.proto";
import "wix/api/annotations.proto";
import "components_catalog_data/forms_spi_common/com/wixpress/appservice/api/upstream/wix/forms/v4/forms_permissions.proto";

message FormSchemaSpiConfig {
  option (.wix.api.decomposite_of) = "wix.forms.v4.FormSchemaSpiConfig";
  // URI where the SPI Implementer is deployed
  string deployment_uri = 1 [(.wix.spi.base_uri) = true];
  // Configuration of namespaces known by implementer
  repeated FormsSchemaNamespaceConfig namespace_configs = 2 [(.wix.api.maxSize) = 3];
}

message FormsSchemaNamespaceConfig {
  option (.wix.api.decomposite_of) = "wix.forms.v4.FormsSchemaNamespaceConfig";
  // Namespace name.
  string namespace = 1 [(.wix.api.minLength) = 10, (.wix.api.maxLength) = 50];
  // Permissions associated with this namespace.
  FormsPermissions permissions = 2;
  // Enable client specific form validation for the namespace, more info in ValidateFormSchema.
  bool schema_validation_enabled = 3;
  // Restrictions associated with this namespace.
  Restrictions restrictions = 4;
  // Enable translations with multilingual
  bool multilingual_enabled = 5;
  // Attempt to select unique name for form
  bool unique_name = 6;
}

message Restrictions {
  option (.wix.api.decomposite_of) = "wix.forms.v4.Restrictions";
  // Maximum amount of forms allowed per namespace.
  int32 max_forms_amount = 1 [(.wix.api.min) = 0, (.wix.api.max) = 15000];
  // Maximum amount of fields allowed per form.
  int32 max_fields_amount = 2 [(.wix.api.min) = 0, (.wix.api.max) = 200];
}
