syntax = "proto3";

// flynt-disable renamed-field-breaking-change
// flynt-disable field-type-breaking-change
// flynt-disable package-matches-structure
package com.wixpress.appservice.api;

option java_package = "com.wixpress.appservice.api.components";

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

// A component that represents a Wix Vibe UI component editing configuration
message WixVibeComponent {
    // flynt-disable renamed-field-breaking-change
    string html_code_tag = 1 [(.wix.api.minLength) = 3, (.wix.api.maxLength) = 100, (wix.api.translatable) = {
        type: SHORT_TEXT
    }];

    // The name of the component
    string name = 2 [(.wix.api.minLength) = 3, (.wix.api.maxLength) = 50, (wix.api.translatable) = {
        type: SHORT_TEXT
    }];

    // Description of the component functionality
    string description = 3 [(.wix.api.maxLength) = 300, (.wix.api.minLength) = 3, (wix.api.translatable) = {
        type: LONG_TEXT
    }];

    // Custom editor actions available for this component on selection
    map<string, CustomAction> custom_actions = 4;

    // Collection ID for inline edit functionality
    string inline_edit_collection_id = 5 [(.wix.api.maxLength) = 50];
}

enum VibeActionType {
    UNKNOWN_ActionType = 0;
    OPEN_DASHBOARD = 1;
    OPEN_CUSTOM_PANEL = 2;
}

// Configuration for custom editor actions
message CustomAction {
    // Display name for the action
    string display_name = 1 [(.wix.api.minLength) = 3, (.wix.api.maxLength) = 50, (wix.api.translatable) = {
        type: SHORT_TEXT
    }];

    // flynt-disable renamed-field-breaking-change
    // flynt-disable field-type-breaking-change
    VibeActionType action_type = 2;

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

        // flynt-disable renamed-field-breaking-change
        VibeDashboardAction open_dashboard = 3;
        VibeCustomPanelAction open_custom_panel = 4;
    }
}

// Dashboard action configuration
message VibeDashboardAction {
    // Dashboard page identifier
    string page_id = 1 [(.wix.api.minLength) = 4, (.wix.api.maxLength) = 50];
}

// Custom panel action configuration
message VibeCustomPanelAction {
    // Exported component identifier
    string component_id = 1 [(.wix.api.format) = GUID];
}