// flynt-disable enum-value-upper-case
syntax = "proto3";

package com.wixpress.appservice.api;

import "wix/api/validations.proto";
import "wix/api/annotations.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/struct.proto";
import "components_catalog_data/unified_components/component_initial_size.proto";
import "components_catalog_data/editor_react_component/display_filter.proto";
import "components_catalog_data/editor_react_component/style.proto";
import "components_catalog_data/editor_react_component/css_property.proto";
import "components_catalog_data/editor_react_component/editor_element_layout.proto";

message PresetItem {
  // DEPRECATED - use preset_css_url instead
  string css_url = 1 [(.wix.api.format) = WEB_URL, (.wix.api.minLength) = 13, (.wix.api.maxLength) = 500, deprecated = true, (.wix.api.field_deprecated) = {
    replaced_by: "preset_css_url",
    target_removal_date: "2025-08-01"
  }];
  // Preset name for displaying purposes in the editor
  string display_name = 2 [(.wix.api.maxLength) = 100, (.wix.api.translatable) = {
    type: SHORT_TEXT
  }];
  // A URL to the preset thumbnail file
  google.protobuf.StringValue thumbnail_url = 3 [(.wix.api.format) = WEB_URL, (.wix.api.maxLength) = 500];
  reserved 4, 5;
  // Optional initial size of the component when switching into this preset
  ComponentInitialSize initial_size = 6;
  // Display filters for the Preset, used to define the visibility of inner / ref elements, style items, data items and custom actions in the editor
  // The Preset is the second in line to affect the display, Element is before and State is after it
  DisplayFilters display_filters = 7 [deprecated = true, (.wix.api.field_deprecated) = {
    replaced_by: "preset_defaults",
    target_removal_date: "2025-08-01"
  }];
  // The default styles for this preset and the inner elements
  PresetStyleDefaults style_defaults = 8 [deprecated = true, (.wix.api.field_deprecated) = {
    replaced_by: "preset_defaults",
    target_removal_date: "2025-08-01"
  }];
  // The style overrides for this preset and the inner elements
  BreakpointPresetStyleOverrides style_overrides = 9;
  // Show this preset in panel only on specified breakpoints
  // (undefined/empty list = all breakpoints, list with values = only those breakpoints)
  // TODO: MaxSize is 2, because we only support small and large breakpoints for now
  repeated BreakpointEnum.Breakpoint optimized_for = 10 [(.wix.api.maxSize) = 2];
  // Optional editor layout behaviors we want to apply when this preset is selected
  EditorElementLayout layout = 11 [deprecated = true, (.wix.api.field_deprecated) = {
    replaced_by: "preset_defaults",
    target_removal_date: "2025-08-01"
  }];
  // A URL to the CSS file of this preset, to be used when you need to apply many css-changes or default-values to the DOM when this preset is selected, optional
  google.protobuf.StringValue preset_css_url = 12 [(.wix.api.format) = WEB_URL, (.wix.api.maxLength) = 500];
  // All the default values that needs to be set when the preset is selected
  PresetElementDefaults preset_defaults = 13;
}

message PresetElementDefaults {
  // The element display name when the preset is selected
  google.protobuf.StringValue display_name = 1 [(.wix.api.maxLength) = 100, (.wix.api.translatable) = {
    type: SHORT_TEXT
  }];
  // The default values for the element css-properties when the preset is selected
  map<string, CssPropertyItemDefaults> css_properties = 2;
  // The default values for the element css-custom-properties when the preset is selected
  map<string, CssPropertyItemDefaults> css_custom_properties = 3;
  // The default styles for the inner elements when the preset is selected
  map<string, PresetInnerElementDefaults> elements = 4;
  // Optional editor layout behaviors we want to apply when this preset is selected
  EditorElementLayout layout = 5;
  // Display filters for the Preset, used to define the visibility of inner / ref elements, style items, data items and custom actions in the editor
  // The Preset is the second in line to affect the display, Element is before and State is after it
  DisplayFilters display_filters = 6;
}

message PresetInnerElementDefaults {
  // The default values for the element css-properties
  map<string, CssPropertyItemDefaults> css_properties = 1;
  // The default values for the element css-custom-properties
  map<string, CssPropertyItemDefaults> css_custom_properties = 2;
  // The default preset and styles for inner elements
  map<string, PresetInnerElementDefaults> elements = 3;
}

message BreakpointEnum {
  enum Breakpoint {
    UNKNOWN_Breakpoint = 0;
    small = 1; // Represents the small (mobile) breakpoint
    reserved 2; // Future support for medium (tablet) breakpoint
    large = 3; // Represents the large (desktop) breakpoint
  }
}

// DEPRECATED: This message is deprecated and will be removed in the future
message PresetStyleDefaults {
  // The default styles for this preset
  map<string, StyleItemDefaults> style = 1;
  // The default styles of inner elements for this preset
  map<string, ElementStyleDefaults> elements = 2;
}

message BreakpointPresetStyleOverrides {
  // The style overrides values for the default breakpoint, which will cascade to all other breakpoints (if not overridden)
  PresetStyleOverrides default = 1;
  // The style overrides values for the small (mobile) breakpoint
  PresetStyleOverrides small = 2;
}

message PresetStyleOverrides {
  // The style overrides for this preset
  map<string, PresetStyleItemOverrides> style = 1 [deprecated = true, (.wix.api.field_deprecated) = {
    replaced_by: "cssProperties or cssCustomProperties",
    target_removal_date: "2025-08-01"
  }];
  // The style overrides of inner elements for this preset
  map<string, ElementStyleOverrides> elements = 2;
  // The default values for the element css-properties when the preset is selected
  map<string, PresetStyleItemOverrides> css_properties = 3;
  // The default values for the element css-custom-properties when the preset is selected
  map<string, PresetStyleItemOverrides> css_custom_properties = 4;
}

message PresetStyleItemOverrides {
  // The override value of this style item
  google.protobuf.Value value = 1;
  // The override values for the style item when the component is in one of the defined states
  map<string, google.protobuf.Value> states_values = 2;
}

// DEPRECATED: This message is deprecated and will be removed in the future
message ElementStyleDefaults {
  reserved  1;
  // The default styles for an element
  map<string, StyleItemDefaults> style = 2;
  reserved 3;
  // The default preset and styles for inner elements
  map<string, ElementStyleDefaults> elements = 4;
}

message ElementStyleOverrides {
  // The override preset for an element
  google.protobuf.StringValue preset_key = 1 [(.wix.api.maxLength) = 100];
  // The override styles for an element
  map<string, PresetStyleItemOverrides> style = 2 [deprecated = true,  (.wix.api.field_deprecated) = {
    replaced_by: "cssProperties or cssCustomProperties",
    target_removal_date: "2025-08-01"
  }];
  // The override preset and styles for inner elements
  map<string, ElementStyleOverrides> elements = 3;
  // The default values for the element css-properties when the preset is selected
  map<string, PresetStyleItemOverrides> css_properties = 4;
  // The default values for the element css-custom-properties when the preset is selected
  map<string, PresetStyleItemOverrides> css_custom_properties = 5;
}