syntax = "proto3";

package com.wixpress.appservice.api.upstream.wix.forms.templates.v1;
option java_package = "com.wixpress.appservice.api.upstream.wix.forms.templates.v1";

import "wix/api/annotations.proto";
import "wix/api/validations.proto";

message ExtensionDetails {
    option (.wix.api.decomposite_of) = "wix.forms.templates.v1.ExtensionDetails";
  // Allow user to add/remove custom field, not present in template
  AddCustomFields add_custom_fields = 1;
  // Allow user to override properties of already existing template fields
  OverrideTemplateFields override_template_fields = 2;
  // Allow user to delete specific fields
  DeleteTemplateFields delete_template_fields = 3;

  message AddCustomFields {
        option (.wix.api.decomposite_of) = "wix.forms.templates.v1.ExtensionDetails.AddCustomFields";
    enum CustomFieldsType {
      // Allow user to add/remove any custom field, not present in template
      ANY = 0;
    }
    // Field types which can be added
    CustomFieldsType field_type = 1;
  }

  message OverrideTemplateFields {
    option (.wix.api.decomposite_of) = "wix.forms.templates.v1.OverrideTemplateFields";
    // Editable properties by field id.
    map<string, EditableFields> editable_fields = 1;

    message EditableFields {
        option (.wix.api.decomposite_of) = "wix.forms.templates.v1.OverrideTemplateFields.EditableFields";
      // List of editable properties for field
      repeated EditablePropertiesEnum.EditableProperties properties = 1 [(.wix.api.maxSize) = 10];
    }

    message EditablePropertiesEnum {
        option (.wix.api.decomposite_of) = "wix.forms.templates.v1.OverrideTemplateFields.EditablePropertiesEnum";
      enum EditableProperties {
        UNKNOWN = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED];
        // Change property responsible for field requirement
        REQUIRED = 1;
        // Change property responsible for field visibility
        HIDDEN = 2;
        // Change property of field label
        LABEL = 3;
        // Change property of field placeholder
        PLACEHOLDER = 4;
        // Change property of field description
        DESCRIPTION = 5;
        // Change property of validation specifying max/min boundaries for input value
        // maxLength/minLength for string, max/min for number.
        INPUT_VALUE_LIMITS = 6;
        // Change property responsible for field default value
        DEFAULT_VALUE = 7;
      }
    }
  }

  message DeleteTemplateFields{
    option (.wix.api.decomposite_of) = "wix.forms.templates.v1.DeleteTemplateFields";
    // List of ids, of fields which can be deleted
    repeated string deletable_field_ids = 1[(.wix.api.format) = GUID, (.wix.api.maxSize) = 100];
  }
}

message TemplateTypeEnum {
    option (.wix.api.decomposite_of) = "wix.forms.templates.v1.TemplateTypeEnum";
  enum TemplateType {
    UNKNOWN = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED];
    // a template, which can be extended by a site specific form with custom properties
    EXTENDABLE = 1;
    // a template, from which a demo form is created
    DEMO = 2;
    // a form input, having more than one field.
    // E.g. address (country, state, street, postal code), or phone number (country code, number)
    FORM_INPUT = 3;
  }
}
