syntax = "proto3";

package com.wixpress.appservice.api;

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

// An iframe to be displayed on the user’s site
message WidgetComponentData {
    // Allow users to resize and move the widget, or pin it to a specific position on all pages of the site.
    FixedPositionOptions fixed_position_option = 1;
    // Widget will automatically be stretched to this width after installing it
    WidgetWidthType widget_width_type = 2;
    // Widget width size
    google.protobuf.Int32Value width = 3 [(wix.api.min) = 0, (wix.api.max) = 9999];
    // Widget width height
    google.protobuf.Int32Value height = 4 [(wix.api.min) = 0, (wix.api.max) = 9999];
    // A public link to the widget endpoint
    google.protobuf.StringValue widget_endpoint_url = 5 [(wix.api.format) = WEB_URL];
    // A public link to the mobile endpoint
    google.protobuf.StringValue widget_mobile_endpoint_url = 6;
    // A public link to the settings endpoint
    google.protobuf.StringValue settings_endpoint_url = 7;
    // A public link to the SEO endpoint
    google.protobuf.StringValue seo_endpoint_url = 8;
    //Product display data for this component
    WidgetDisplay widget_display = 9;
    // When true, this is the default component
    bool default = 11;
    // When this is turned on, this page will be added to the site when installing the app, regardless of whether it's the default component or not
    bool essential = 12;
    // Published state for this widget
    bool published = 13;
    // When true, allow this widget to be added only once
    bool add_only_once = 14;
    // This ID is used to identify your widget endpoint in a Wix site. You can use this ID when using methods of the Wix SDK
    string tpa_widget_id = 15 [(wix.api.readOnly) = true];
    //Where this should be rendered
    Position position = 16;
    // Article id in settings panel
    google.protobuf.StringValue help_id = 17;
    // Default Mobile Height
    google.protobuf.Int32Value default_mobile_height = 18;
    // Min Mobile Height
    google.protobuf.Int32Value min_mobile_height = 19;
    // Mobile Settings Enabled
    bool mobile_settings_enabled = 20;
    // Mobile article id in settings panel
    google.protobuf.StringValue mobile_help_id = 21;
    // Editor setting version. optional values: 1 (old - deprecated) or 2 (new). default value is 2
    google.protobuf.Int32Value settings_version = 22 [(wix.api.min) = 1, (wix.api.max) = 2];
    // If setting version is 1, this will be the public link to the settings endpoint
    google.protobuf.StringValue settings_endpoint_url_v1 = 23; //todo: WEB_URL only after migration from oldJson
    // A public link to the settings endpoint on ADI editor
    google.protobuf.StringValue on_boarding_settings_endpoint_url = 24; //todo: WEB_URL check if need to migrate from oldJson
    // The sub pages list for this component to be rendered in
    repeated SubPage sub_pages = 25;
    //If this component should be stretched in relation to a form factor (desktop, tablet, mobile)
    IsStretched is_stretched = 26;
    //Any margins this page should have in relation to a form factor (desktop, tablet, mobile)
    Margins margins = 27;
    //Any docking this page (horizontal / vertical) should have in relation to a form factor (desktop, tablet, mobile)
    Docking docking = 28;
    //The height of this page in relation to a form factor (desktop, tablet, mobile)
    Height height_break_points = 29;
    //The width of this page in relation to a form factor (desktop, tablet, mobile)
    Width width_break_points = 30;
    // Keep default and let users stretch widget to full width (GFPP)
    bool add_stretch_button = 31;
    // toggle to mark whether the editor should revoke an app that contains this component.
    bool exclude_from_auto_revoke = 32;
    // should be <%=serviceUrl('your_artifact_id', '<resource-path>')%>, this field will later be used to trasform the settings url field in both the component and the **derived widget**
    google.protobuf.StringValue settings_endpoint_url_template = 33;
    // should be <%=serviceUrl('your_artifact_id', '<resource-path>')%>, this field will later be used to trasform the settings url field in both the component and the **derived widget**
    google.protobuf.StringValue settings_endpoint_url_v1_template = 34;
    // The component-type as will be written in Document Management.
    google.protobuf.StringValue component_type = 35 [(.wix.api.maxLength) = 512, (wix.api.field_exposure) = PRIVATE];
    // The type of the referenced schema e.g. `wysiwyg.viewer.components.tpapps.TPAWidget`.
    google.protobuf.StringValue ref_type = 36 [(.wix.api.maxLength) = 512, (wix.api.field_exposure) = PRIVATE];
    // if true, ssr will not cache pages that contain this widget
    bool ssr_cache_excluded = 37 [(wix.api.field_exposure) = PRIVATE];
    // if true, when site member is logged in and this widget is in the page - ssr will not cache it
    bool site_members_ssr_cache_excluded = 38 [deprecated = true, (.wix.api.field_deprecated) = {
        replaced_by: "site_members_ssr_caching"
        target_removal_date: "2025-12-31"
    }, (wix.api.field_exposure) = INTERNAL];
    // Controls SSR caching behavior when site members are logged in
    SiteMembersSsrCaching site_members_ssr_caching = 39 [(wix.api.field_exposure) = INTERNAL];
}

// Allow users to resize and move the widget, or pin it to a specific position on all pages of the site.
message FixedPositionOptions {
    // Vertical widget position in the browser window
    WidgetVertical widget_vertical = 1;
    // Horizontal widget position in the browser window
    WidgetHorizontal widget_horizontal = 2;
}

// Vertical widget position in the browser window
enum WidgetVertical {
    NONE_VERTICAL = 0;
    TOP = 1;
    CENTER_VERTICAL = 2;
    BOTTOM = 3;
}

// Horizontal widget position in the browser window
enum WidgetHorizontal {
    NONE_HORIZONTAL = 0;
    LEFT = 1;
    CENTER_HORIZONTAL = 2;
    RIGHT = 3;
}

// Widget will automatically be stretched to this width after installing it
enum WidgetWidthType {
    NONE_TYPE = 0;
    // A custom width for the widget
    CUSTOM = 1;
    // Full width of the browser window
    FULL = 2;
}

enum Region {
    no_region = 0;
    header = 1;
    pageContainer = 2;
    footer = 3;
}

message Position {
    Region region = 1;
}
