syntax = "proto3";

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

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

message FormLayout {
    option (.wix.api.decomposite_of) = "wix.forms.v4.FormLayout";
  // Layout for large break point.
  BreakPoint large = 1;
  // Layout for medium break point.
  BreakPoint medium = 2;
  // Layout for small break point.
  BreakPoint small = 3;
}

message BreakPoint {
    option (.wix.api.decomposite_of) = "wix.forms.v4.BreakPoint";
  // Description of layouts for items.
  repeated ItemLayout items = 1 [(.wix.api.maxSize) = 500];
  // Amount of columns of layout grid.
  google.protobuf.Int32Value columns = 2;
  // Row height of layout grid.
  google.protobuf.Int32Value row_height = 3;
  // Description of elements margins.
  Margin margin = 4;
  // Description of elements paddings.
  Margin padding = 5;
  // Sections of the layout, which allow manage fields
  repeated Section sections = 6 [(.wix.api.maxSize) = 100];

  message Margin {
        option (.wix.api.decomposite_of) = "wix.forms.v4.BreakPoint.Margin";
    // Horizontal value.
    google.protobuf.Int32Value horizontal = 1;
    // Vertical value.
    google.protobuf.Int32Value vertical = 2;
  }

  message Section {
        option (.wix.api.decomposite_of) = "wix.forms.v4.BreakPoint.Section";
    // Id of the section
    string id = 1 [(.wix.api.format) = GUID, (.wix.api.minLength) = 1];
    // Horizontal coordinate in the grid.
    google.protobuf.Int32Value row = 2;
    // A list of field identifiers that are permitted to be placed within a section.
    // The section will only accept fields with IDs specified in this list.
    // If the section encounters the $new key within the list,
    // it allows the inclusion of fields not explicitly listed,
    // enabling dynamic addition of new fields.
    repeated string allowed_field_ids = 3 [(.wix.api.maxSize) = 100, (.wix.api.maxLength) = 100];
  }
}

message ItemLayout {
    option (.wix.api.decomposite_of) = "wix.forms.v4.ItemLayout";
  // Form field reference id.
  string field_id = 1 [(.wix.api.format) = GUID];
  // Horizontal coordinate in the grid.
  google.protobuf.Int32Value row = 2;
  // Vertical coordinate in the grid.
  google.protobuf.Int32Value column = 3;
  // Height.
  google.protobuf.Int32Value width = 4;
  // Width.
  google.protobuf.Int32Value height = 5;
}
