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

package com.wixpress.appservice.api;

import "wix/api/validations.proto";
import "wix/api/annotations.proto";
import "components_catalog_data/panel.proto";

// List of the native actions
message Actions {
  // Allows enabling / disabling and overriding the settings action
  Action settings = 1;
  // Allows enabling / disabling and overriding the design action
  Action design = 2;
  // Allows enabling / disabling and overriding the media action
  Action media = 3;
  // Allows enabling / disabling and overriding the manageItems action
  Action manage_items = 4;
  // Allows enabling / disabling and overriding the dashboard action
  DashboardAction dashboard = 5;
  // Allows enabling / disabling and overriding the manageMenu action
  Action manage_menu = 6;
  // Allows enabling / disabling and overriding the container action
  Action container = 7;
}
  
message Action {
  // deprecated `hidden` field, use `displayFilters` instead
  reserved 1;
  // The public human-readable name given to the  action by the developer.
  string display_name = 2 [(.wix.api.maxLength) = 50, (.wix.api.translatable) = {
    type: SHORT_TEXT
  }];
  // A model definition for declaring a concrete instructions action will perform
  Execution execution = 4;
}

message DashboardAction {
  // deprecated `hidden` field, use `displayFilters` instead
  reserved 1;
  // The public human-readable name given to the  action by the developer.
  string display_name = 2 [(.wix.api.maxLength) = 50, (.wix.api.translatable) = {
    type: SHORT_TEXT
  }];
  // Optional pageId of the dashboard in case there is more than one
  string dashboard_page_id = 4 [(.wix.api.minLength) = 4, (.wix.api.maxLength) = 50];
  // A model definition for declaring a concrete instructions action will perform
  Execution execution = 5;
}

message ActionTypeEnum {
  enum ActionType {
    UNKNOWN_ActionType = 0;
    data = 1;
    event = 2;
    panel = 3;
    forward = 4;
    style = 5 [deprecated = true];
    displayGroup = 6;
    cssProperty = 7;
    cssCustomProperty = 8;
  }
}

message Execution {
  // The action type allows to determine the return type of the execution function
  ActionTypeEnum.ActionType action_type = 1;

  oneof action_execute {
    option (.wix.api.aligned_with_enum) = {
      field: "action_type";
      suffix: "";
    };
    // Executes an action that manipulates component's data
    DataAction data = 2;
    // Executes an action that manipulates component's style
    StyleAction style = 6 [deprecated = true, (.wix.api.field_deprecated) = {
      replaced_by: "cssProperty or cssCustomProperty";
      target_removal_date: "2025-08-01"
    }];
    // Executes an event-based action. Triggered event should be intercepted in the editor script
    EventAction event = 3;
    // Opens a URL inside an iframe panel
    PanelAction panel = 4;
    // Executes an action on a target element (based on path)
    ForwardAction forward = 5;
    // Executes an action that is connected to a display-group
    DisplayGroupAction display_group = 7;
    // Executes an action that points into a specific css-property-key,
    CssPropertyAction css_property = 8;
    // Executes an action that points into a specific css-custom-property-key,
    CssCustomPropertyAction css_custom_property = 9;
  }
}

// Represents an action that points into a specific data-item-key,
// the outcome of clicking such action will be determined by the editor
message DataAction {
  // Points to the data item within the component’s data structure
  string data_item_key = 1 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 50];
}

// DEPRECATED - use CssPropertyAction or CssCustomPropertyAction
message StyleAction {
  // Points to the style item within the component’s style structure
  string style_item_key = 1 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 50];
}

// Represents an action that points into a single css-property,
// the outcome of clicking such action will be determined by the editor
message CssPropertyAction {
  // Points to the style item within the component’s css-properties map
  string css_property_key = 1 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 50];
}

// Represents an action that points into a single css-custom-property,
// the outcome of clicking such action will be determined by the editor
message CssCustomPropertyAction {
  // Points to the style item within the component’s css-custom-properties map
  string css_custom_property_key = 1 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 50];
}

// Represents an action that points into a specific display-group-key,
// the outcome will make the chosen display group visible to the user for changing the groups values in the component
message DisplayGroupAction {
  // The display group to be used
  string display_group_key = 1 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 50];
}
  
// Executes an event-based action. Triggered event should be intercepted in the editor script
message EventAction {
  // Name of the event to be handled by the editor script
  string event = 1 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 50];
}

// Represents the options for loading a panel configuration

message PanelTypeEnum {
  // list of possible panel types
  enum PanelType {
    UNKNOWN_PanelType = 0;
    panelId = 1;
    inline = 2 [(.wix.api.enum_exposure) = INTERNAL];
  }
}

// Represents a URL-based action that opens a panel
message PanelAction {
  // The selected panel reference type
  PanelTypeEnum.PanelType panel_type = 1;

  oneof SelectedPanelType {
    option (.wix.api.aligned_with_enum) = {
      field: "panel_type";
      suffix: "";
    };

    // For using a panel defined in dev-center
    string panel_id = 2 [(.wix.api.format) = GUID];
    // Internal implementation as an interim step, a defined inline panel
    Panel inline = 3 [(.wix.api.field_exposure) = INTERNAL];
  }
}

message ActionNameEnum {
  enum ActionName {
    UNKNOWN_ActionName = 0;
    settings = 1; // Manage the component settings, this usually aligns with component data
    design = 2; //  Manage the `style` information
    media = 3; // Manage any media type `data` defined in the component
    manageItems = 4; // Manage items in the component data
    dashboard = 5; // Open the apps default dashboard page, or select one if there is more than one
    custom = 6; //  actionName to be triggered from the defined custom actions
    manageMenu = 7; // Manage Menu Items
    container = 8; // Shows the container actions, or select one if there is more than one
  }
}

// Represents an action that targets another element within the component
message ForwardAction {
  // Specifies the action names (one of the natives or custom)
  ActionNameEnum.ActionName action_name = 1;
  // Path to the target element
  string element_path = 2 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 500];

  oneof action {
    option (.wix.api.aligned_with_enum) = {
      field: "action_name";
      suffix: "";
    };

    // Used when actionType is custom
    string custom = 3 [(.wix.api.minLength) = 1, (.wix.api.maxLength) = 50];
  }
}
  

  
