syntax = "proto3";

package com.wixpress.appservice.api;

import "wix/api/validations.proto";
import "components_catalog_common.proto";
import "components_catalog_data/unified_components/unified_widget.proto";
import "components_catalog_data/unified_components/shared.proto";
import "components_catalog_data/unified_components/widget_size.proto";
import "components_catalog_data/unified_components/editor_behaviors.proto";
import "components_catalog_data/unified_components/preset.proto";

message WidgetData {
     // The script url that should render on the widget
     string script_url = 3 [(wix.api.format) = WEB_URL];
     // Unique tag name to use in order to connect your JS script to your web component
     string tag_name = 4 [(.wix.api.minLength) = 2, (.wix.api.maxLength) = 64]  ;
     // Type of JavaScript modularization approach used in the custom element
     CustomElementScriptType script_type = 5;

     enum CustomElementScriptType {
          NONE = 0;
          COMMON_JS = 1; // CommonJS modularization approach
          ES_MODULE = 2; // ES Module modularization approach
     }
}

message CustomElementWidget {
    // Base info of component by shared logic of unified components
     BaseInfo base = 1;
     // Unified widget installation settings
     WidgetInstallationSettings installation = 2;
     // The extension data for this component
     WidgetData widget_data = 3;
     // The widget's editor behaviors
     EditorBehaviors behaviors = 4;
     // The size of the widget
     WidgetSize size = 5;
     // The runtime dependencies array to declare the widget packages.
     repeated WixDependency dependencies = 6 [(wix.api.maxSize) = 50];
     // The array of this widget's presets
     repeated Preset presets = 7 [(wix.api.maxSize) = 50];
}
