syntax = "proto3";

package com.wixpress.appservice.api;
import "wix/api/validations.proto";
import "google/protobuf/wrappers.proto";
import "wix/api/annotations.proto";

message PanelSize {
  enum Width {
    UNKNOWN_WIDTH = 0 [(wix.api.enum_maturity) = NOT_IMPLEMENTED, (wix.api.enum_exposure) = PRIVATE];
    SMALL = 1;
    MEDIUM = 2;
    LARGE = 3;
  }

  // height of the panel in px
  google.protobuf.Int32Value height = 1 [(.wix.api.min) = 150];
  // width of the panel
  Width width = 2;
}

message Panel {
  // external reference to the panel
  google.protobuf.StringValue reference_id = 1 [(wix.api.maxLength) = 20, (wix.api.field_exposure) = INTERNAL];
  // The title of the panel
  string display_name = 2 [(wix.api.translatable) = {
    type: SHORT_TEXT
    grouping: "display_name"
  }, (wix.api.minLength) = 1, (wix.api.maxLength) = 200];
  // Optional: The size of the panel
  PanelSize size = 3;
  // The selected panel content type
  PanelContentTypeEnum.PanelContentType content_type = 4;

  oneof SelectedContentType {
    option (.wix.api.aligned_with_enum) = {
      field: "content_type";
      suffix: "";
    };
    // The URL to the html page of the panel in case of iFrame
    string url = 5 [(wix.api.format) = WEB_URL];
    // The configuration for rendering the panel directly in the host
    CodePanel code = 6 [(wix.api.field_exposure) = INTERNAL];
  }
}

message PanelContentTypeEnum {
  // Represents the options for panel content types
  enum PanelContentType {
    UNKNOWN_PanelContentType = 0;
    url = 1;
    code = 2 [(wix.api.enum_exposure) = INTERNAL];
  }
}

// Represents the information needed for code panels
message CodePanel {
  // The url for the panel code
  string bundle_url = 1 [(wix.api.format) = WEB_URL];
  // The url for the panel css
  // flynt-disable field-type-breaking-change
  google.protobuf.StringValue css_url = 2 [(wix.api.format) = WEB_URL];
}
