syntax = "proto3";

package com.wixpress.appservice.api;

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

message Resources {
  // The bundle we will load and render in the browser in the site
  ClientResources client = 1;
  // An optional client definition of the component we will load and render in the editor, *it replaces the client bundle.*
  // The  main use case is to control the live site component and enable different experiences in the editor.
  // For example, supporting `states` manipulation:
  // Show calendar in the editor
  // Open drop down in the editor
  ClientResources editor = 7;
  // The bundle for SSR, should not include any DOM API references
  Resource server = 2;
  // The optional component SDK to expose to Velo Users to interact with the component
  Resource sdk = 3;
  // Details for how to load translations for the component
  TranslationResources translations = 4;
  // The optional interactions configuration JSON file
  Resource interactions = 5;
  // As URL to store the asset generator for runtime rendering
  google.protobuf.StringValue viewer_reduced_model = 6 [(.wix.api.format) = WEB_URL, (.wix.api.field_exposure) = INTERNAL];
  // A URL to get schema references of items for component
  google.protobuf.StringValue schema_refs_url = 8 [(.wix.api.format) = WEB_URL, (.wix.api.field_exposure) = INTERNAL];
  // A URL to get the resolved CSS for the component for runtime rendering of CSS
  google.protobuf.StringValue viewer_runtime_css = 9[(.wix.api.format) = WEB_URL, (.wix.api.field_exposure) = INTERNAL]; 
}

message TranslationResources {
  // The URL that we will add the language to for fetching translations, example: `https://somecdn.com/translations/`
  string base_path = 1 [(.wix.api.format) = WEB_URL];
  // The list of supported languages according to the [ISO-639-1 specification](https://en.wikipedia.org/wiki/ISO_639-1)
  repeated string languages = 2 [(.wix.api.format) = LANGUAGE, (.wix.api.maxSize) = 37];
}

message ClientResources {
  // A URL to an ESM javascript bundle. It's default export should be the component
  string component_url = 1 [(.wix.api.format) = WEB_URL];
  // A URL to the CSS file that is the default layout and style for the component
  google.protobuf.StringValue css_url = 2 [(.wix.api.format) = WEB_URL];
  // A list of service dependencies required by the component, example: ['@wix/environment']
  repeated string service_dependencies = 3[ (wix.api.maxLength) = 80, (wix.api.maxSize) = 20];
  // A module specifier for the component’s react code.
  google.protobuf.StringValue module_specifier = 4 [(.wix.api.maxLength) = 100];
}

message Resource {
  // A URL to an ESM javascript bundle
  string url = 1 [(.wix.api.format) = WEB_URL];
}
