syntax = "proto3";

package com.wixpress.appservice.api;

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

message DisplayProperties {
    DisplayValue top = 1;
    DisplayValue right = 2;
    DisplayValue bottom = 3;
    DisplayValue left = 4;
}

message DisplayValue {
    UnitType type = 1;
    google.protobuf.Int32Value value = 2;
}

enum UnitType {
    NO_UNIT = 0;
    AUTO = 1;
    PX = 2;
    VH = 3;
    VW = 4;
    PERCENTAGE = 5;
}

message Docking {
    DockingProperties desktop = 1;
    DockingProperties tablet = 2;
    DockingProperties mobile = 3;
}

message Margins {
    DisplayProperties desktop = 1;
    DisplayProperties tablet = 2;
    DisplayProperties mobile = 3;
}

message Height {
    DisplayValue desktop = 1;
    DisplayValue tablet = 2;
    DisplayValue mobile = 3;
}

message Width {
    DisplayValue desktop = 1;
    DisplayValue tablet = 2;
    DisplayValue mobile = 3;
}

message IsStretched {
    google.protobuf.BoolValue desktop = 1;
    google.protobuf.BoolValue tablet = 2;
    google.protobuf.BoolValue mobile = 3;
}

message DockingProperties {
    HorizontalDocking horizontal = 1;
    VerticalDocking vertical = 2;
}

enum HorizontalDocking {
    NO_HDOCKING = 0;
    LEFT_DOCKING = 1;
    HCENTER = 2;
    RIGHT_DOCKING = 3;
}

enum VerticalDocking {
    NO_VDOCKING = 0;
    TOP_DOCKING = 1;
    VCENTER = 2;
    BOTTOM_DOCKING = 3;
}

message WidgetDisplay {
    string name = 1 [(wix.api.translatable) = {
        type: SHORT_TEXT
        name: "Name"
        grouping: "name"
    }];
    // short description about the widget
    google.protobuf.StringValue short_description = 2 [(wix.api.maxLength) = 300, (wix.api.translatable) = {
        type: LONG_TEXT
        name: "Description"
        grouping: "description"
    }];
    repeated string images = 3; // images showing off how the widget looks
    google.protobuf.Int32Value order = 4; // optional, if no order exist for all components, will be decided by order in array (non-deterministic)
    google.protobuf.FloatValue price = 5;
    google.protobuf.StringValue variation_id = 6;
}

message SubPage {
    // The path of the subpage
    string key = 1;
    // If it's sub entities are enumerable for querying (for example, a search endpoint is not enumerable)
    bool enumerable = 2;
    // Should hide inner routes of this sub page from floating dynamic pages navigation bar
    bool hide_from_floating_nav_bar = 3;
    // Should hide this sub page from selections in link panel
    bool hide_from_link_panel = 4;
}

// Error reporting configuration for the App
message ErrorReporting {
    // Data of the artifact that reports an error.
    message ErrorReportingArtifact {
        // The full artifact id of the project which errors are associated with (Example: com.wixpress.my-artifact)
        string full_artifact_id = 1 [(.wix.api.minLength) = 1, (wix.api.maxLength) = 255];
        // The project version which errors are associated with (Example: Falcon fingerprint)
        string version = 2 [(.wix.api.minLength) = 1, (wix.api.maxLength) = 255];
    }

    // An error reporting URL to be used by our infra (Example: A sentry DSN url)
    string url = 1;
    // Optional: Data about the artifact that reports the error.
    ErrorReportingArtifact artifact = 2;
}

// List of back-office hosting platforms
enum BackOfficeHostingPlatforms {
    NO_HOSTING_PLATFORM = 0;
    // Site Dashboard (The Wix Dashboard)
    BUSINESS_MANAGER = 1;
    // User Account Dashboard
    ACCOUNT_MANAGER = 2;
    // Internal: Dev center
    DEV_CENTER = 3;
    // Enterprise dashboard (available to enterprise accounts only)
    ENTERPRISE = 4;
    //Partners dashboard (available to partners accounts only)
    PARTNERS_DASHBOARD = 5;
    //Employee only financial support dashboard
    FINANCIALS_INTERNAL_BO = 6;
    //FED Guild POC dashboard
    FED_GUILD_POC = 7;
    // Studio dashboard
    STUDIO_DASHBOARD = 8;
    // Channels dashboard (available to channels accounts only)
    CHANNELS = 9;
    // Wix internal dashboard for data tools (proffesional data consumers, i.e Business Analysts, Data Engineers...)
    DATA_TOOLS = 10;
    // Internal back-office for payment service provider management
    PSP_BACKOFFICE = 11;
    // Rise.ai account dashboard
    RISE_PLATFORM_ACCOUNT_DASHBOARD = 12;
    // Enterprise demo dashboard (available to possible enterprise accounts for demo purposes)
    DEMO_DASHBOARD_ENTERPRISE = 13;
    // A new AI scheduling assistant product dashboard (codename: "Nownia")
    AI_SCHEDULING_ASSISTANT_DASHBOARD = 14;
    //Employee only getting paid cluster dashboard
    GETTING_PAID = 15;
    // Wix internal dashboard for data (non proffesional data consumers, i.e any Wix Employee that has a need for BI data)
    DATA = 16;
    // Dashboard for viral forms/lite events/etc
    LITE_DASHBOARD = 17;
    // Picasso AI application POC
    PICASSO_EDITOR = 18;
    // Base44 Host Dashboard POC
    BASE44_DASHBOARD_POC = 19;
    // Wixel Editor
    WIXEL_EDITOR = 20;
    // Base44 Platform
    BASE44_PLATFORM = 21;
}

// Represents a sidebar entity in a back office sidebar, used to configure required/hidden entities
message BackOfficeCustomizationSidebarEntity {
    // Type of sidebar entity in a back office sidebar (cluster/category/page)
    enum SidebarEntityType {
        UNKNOWN_TYPE = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED];
        CATEGORY = 1;
        PAGE = 2;
        APP = 3;
    }
    // Sidebar entity type
    SidebarEntityType type = 1;
    oneof item {
        option (.wix.api.aligned_with_enum) = {
            field: "type";
            suffix: "id";
        };
        // Category id
        google.protobuf.StringValue category_id = 2 [(wix.api.minLength) = 1, (wix.api.maxLength) = 50];
        // Page id
        google.protobuf.StringValue page_id = 3 [(wix.api.format) = GUID];
        // App id
        google.protobuf.StringValue app_id = 4 [(wix.api.format) = GUID];

    }
}

// Internal: Specifications for loading an asset via JS in the back office
message BackOfficeScriptAsset {
    // Type attribute for the script tag
    enum BackOfficeScriptAssetType {
        // Script will be loaded without a type attribute
        UNKNOWN_TYPE = 0;
        // Use "module" as the script type
        MODULE = 1;
    }

    // The JavaScript file to load
    string url = 1 [(wix.api.format) = WEB_URL];
    // Namespacing of the component in the Webpack Module Federation registry
    string container_id = 2 [(.wix.api.minLength) = 1];
    // Key name for the retrieval of the component
    string exported_name = 3 [(.wix.api.minLength) = 1];
    // Optional: What type should by used on <script> tag.
    BackOfficeScriptAssetType script_type = 4;
}

// Options for widgets that are added as a page during installation
message PageOptions {
    // Display name of the page that will be shown in the page menu.
	string page_name = 1;
    // The page ID used for navigation purposes. Once set cannot be changed.
	string page_id = 2;
}

message LightboxOptions {
    // Display name of the lightbox that will be shown in the lightbox menu.
	string lightbox_name = 1;
    // The lightbox ID used for navigation purposes. Once set cannot be changed.
	string lightbox_id = 2;
}

// Defines the main preset per breakpoint for the widget.
message MainPresets {
    // The main desktop preset.
	string desktop_preset_id = 1;
    // The main tablet preset.
	string tablet_preset_id = 2;
    // The main mobile preset.
	string mobile_preset_id = 3;
}

// Settings to control the behavour of widgets when installed in a wix site.
message InstallationSettings {
    // The page to which a new widget can be added
    enum InstallPage {
        // Don't add widget to a page
        NO_PAGE = 0;
        // Add widget to the current page in the editor
        CURRENT = 1;
        // Add widget to a new page in the editor
        PAGE = 2;
        // Add widget to a new lightbox in the editor
        LIGHTBOX = 3;
    }

    // How to add the widget automatically to the site. Options could be `NO_PAGE`, `CURRENT`, `PAGE` or `LIGHTBOX`.
    InstallPage install_page = 1;
    // Controls whether to show or hide the widget in the add panel.
    google.protobuf.BoolValue show_in_add_panel = 2;
    // Defines the main preset per breakpoint for the widget.
    MainPresets main_presets = 3;

    oneof options {
        // Extra options needed when `install_page` is set to `PAGE`.
        PageOptions page_options = 4;
        // Extra options needed when `install_page` is set to `LIGHTBOX`.
        LightboxOptions lightbox_options = 5;
    }
}

message WixDependency {
    // The fully qualified package name from npm, example: @wix/frontend-location
    string package_name = 1 [(.wix.api.minLength) = 2, (.wix.api.maxLength) = 100];
    // The major version of the package (this may be a detail included in the package name, but is conventional in NPM with semver semantics
    int32 version = 2;
}

message ComponentMetaData {
    google.protobuf.StringValue title = 1 [(wix.api.translatable) = {
        type: SHORT_TEXT
        grouping: "subtitle"
    }, (wix.api.minLength) = 1, (wix.api.maxLength) = 200]; // Component title
    google.protobuf.StringValue description = 2 [(wix.api.translatable) = {
        type: SHORT_TEXT
        grouping: "subtitle"
    }, (wix.api.minLength) = 1, (wix.api.maxLength) = 200]; // Component description
    repeated Keywords keywords = 3 [(wix.api.maxSize) = 100]; // Searchable keywords
    bool searchable = 4; // Is searchable
}

message DiscoveryMetaData {
    google.protobuf.StringValue title = 1 [(wix.api.translatable) = {
        type: SHORT_TEXT
        grouping: "subtitle"
    }, (wix.api.minLength) = 1, (wix.api.maxLength) = 200]; // Component title
    google.protobuf.StringValue description = 2 [(wix.api.translatable) = {
        type: SHORT_TEXT
        grouping: "subtitle"
    }, (wix.api.minLength) = 1, (wix.api.maxLength) = 200]; // Component description
    repeated Keywords keywords = 3 [(wix.api.maxSize) = 100]; // Searchable keywords
    bool searchable = 4; // Is searchable
}

message ExtensionExposure {
    enum Exposure {
        PRIVATE = 0; // Unexposed. to be used by dev team only
        INTERNAL = 1; // Exposed internally
        PUBLIC = 2; // Exposed to the world
    }

    enum Maturity {
        ALPHA = 0; // Immature. subject to breaking changes
        BETA = 1; // Ready for integration. 2 weeks notice before breaking changes are applied
        GA = 2; // Matured. breaking changes are not acceptable. 3 month notice before sunset
        NOT_IMPLEMENTED = 3; // Not yet implemented
    }

    // The exposure of the component
    Exposure exposure = 1 [(wix.api.field_exposure) = INTERNAL];
    // Determines if the component is production ready
    Maturity maturity = 2;
}

message Keywords {
    string id = 1; // Keyword ID
    string value = 2 [(wix.api.translatable) = {
        type: SHORT_TEXT
        grouping: "keyword"
    }, (wix.api.minLength) = 1, (wix.api.maxLength) = 200]; // Keyword value
}

// SSR caching configuration for site members
enum SiteMembersSsrCaching {
    UNKNOWN_SITE_MEMBERS_SSR_CACHING = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED];
    // SSR caching is allowed when site members are logged in
    CACHING_ALLOWED = 1;
    // SSR caching is not allowed when site members are logged in
    CACHING_NOT_ALLOWED = 2;
}

// MPA Navigation configuration
enum MpaNavigation {
    DEFAULT = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED];
    // MPA Navigation is enabled for this component
    ALLOWED = 1;
    // MPA Navigation is disabled for this component
    NOT_ALLOWED = 2;
}
