syntax = "proto3";

package com.wixpress.appservice.api;

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

// Editor Add-on component
message EditorAddon {
    // Deprecated, use editor_script
    string editor_script_url = 1 [(wix.api.format) = WEB_URL, deprecated = true, (wix.api.field_deprecated) = {
        replaced_by: "editor_script"
        target_removal_date: "2025-06-01"
    }];

    // Tool panel configuration.
    ToolPanelConfig tool_panel_config = 2;

    message ToolPanelConfig {
        // Iframe URL that hosts the add-on tool panel's content.
        string url = 1 [(wix.api.format) = WEB_URL];

        // Addon tool panel width.
        string width = 2;

        // Addon tool panel height.
        string height = 3;

        // Initial position of the opened panel.
        // Offset from top left corner of the container.
        InitialPosition initial_position = 4;

        message InitialPosition {
            // Offset from the left. For example, `"50px"`.
            string x = 1;

            // Offset from the top. For example, `"50px"`.
            string y = 2;
        }
    }

    // Information to display in the addons market.
    AddonMarketData market_data = 3;

    message AddonMarketData {
        // Addon name.
        string name = 1 [(wix.api.minLength) = 5, (wix.api.translatable) = {
            type: SHORT_TEXT
            name: "Name"
            grouping: "name"
        }];

        // Deprecated, use teaser
        string description = 2 [(wix.api.minLength) = 10, (wix.api.translatable) = {
            type: LONG_TEXT
            name: "Description"
            grouping: "description"
        }, deprecated = true, (wix.api.field_deprecated) = {
            replaced_by: "teaser"
            target_removal_date: "2025-06-01"
        }];

        // URL source of the addon's icon. Must be 36px x 36px in JPG or PNG format.
        google.protobuf.StringValue icon_url = 3 [(wix.api.format) = WEB_URL];

        // Author's name.
        string author = 4;

        // Addon teaser.
        google.protobuf.StringValue teaser = 5 [(wix.api.minLength) = 10, (wix.api.maxLength) = 60, (wix.api.translatable) = {
            type: LONG_TEXT
            name: "Teaser"
            grouping: "teaser"
        }];
    }

    // Optional, path to a Javascript file that will run in Editor environment
    google.protobuf.StringValue editor_script = 4 [(wix.api.format) = WEB_URL];

    // Toggle to mark whether the editor should revoke an app that contains this component.
    bool exclude_from_auto_revoke = 5;
}
