syntax = "proto3";

package com.wixpress.appservice.api.upstream.com.wixpress.audiences.common.v1;

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

option java_multiple_files = true;
option java_package = "com.wixpress.appservice.api.upstream.com.wixpress.audiences.common.v1";

enum ParticipantType {
  UNKNOWN_TYPE = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED];
  WIX_USER = 1;
  CONTACT = 2;
  ANONYMOUS = 3;
}

enum Scope {
  UNKNOWN_SCOPE = 0 [(wix.api.enum_maturity) = NOT_IMPLEMENTED, (.wix.api.enum_exposure) = PRIVATE];
  SPECIFIC_SITE = 1; // Provider audience is available only in scope of specific site
  NON_SPECIFIC_SITE = 2;  // Provider audience is available only in scope of non specific site
}

message InterfaceConfiguration {
    option (.wix.api.decomposite_of) = "wix.audiences.common.v1.InterfaceConfiguration";
  // Type of interface configuration
  Type type = 1;

  oneof ofType {
    option (.wix.api.aligned_with_enum) = {
      field: "type";
      suffix: "configuration";
    };

    // Should be filled if the provider implements its own custom UI
    WidgetComponent widget_component_configuration = 2;

    // Should be filled if the provider implements Item Selection UI Component
    ItemSelection item_selection_configuration = 3 [(.wix.api.field_exposure) = INTERNAL];
  }

  enum Type {
    UNKNOWN_TYPE = 0 [(wix.api.enum_maturity) = NOT_IMPLEMENTED, (.wix.api.enum_exposure) = PRIVATE];
    WIDGET_COMPONENT = 1; // Widget component built by the provider
    ITEM_SELECTION = 2; // Item Selection, in case the provider implemented item selection component
  }

  message WidgetComponent {
    option (.wix.api.decomposite_of) = "wix.audiences.common.v1.WidgetComponent";
    // widget component id
    string component_id = 1 [(wix.api.format) = GUID];
  }

  message ItemSelection {
    option (.wix.api.decomposite_of) = "wix.audiences.common.v1.ItemSelection";
    // Item selection provider key
    string provider_key = 1 [(wix.api.minLength) = 1, (wix.api.maxLength) = 100];

    // Mapping between item selection ids array to correlate input schema field
    string schema_ids_field_name = 2 [(wix.api.minLength) = 1, (wix.api.maxLength) = 25];
  }
}