syntax = "proto3";

import "google/protobuf/struct.proto";
import "wix/spi/definitions.proto";
import "wix/api/annotations.proto";

package com.wixpress.appservice.api.upstream.com.wixpress.esb.spi.trigger.v1;

message TriggerProviderSPIConfig {
    option (.wix.api.decomposite_of) = "com.wixpress.esb.spi.trigger.v1.TriggerProviderSPIConfig";
  /*
    The trigger configuration

    example of a trigger:

    {
      appId: "56cc7843-fdfc-417f-a660-d4af9a2eafe3",
      triggerKey: "form_submit",
      displayName: "Visitor submits a form",
      payloadDataSchema: {
        "$schema": "http://json-schema.org/draft-07/schema",
        "type": "object",
        "title": "Visitor submits a form Payload Schema",
        "description": "The schema of the payload that is part of the triggered event",
        "default": {},
        "examples": [
          {
            "formId": "60d2cd50-1047-4164-884d-8c24fbda84bb",
            "formName": "My Cool Form
          }
        ],
        "properties": {
          "formId": {
            "$id": "#/properties/formId",
            "type": "string",
            "format": "uuid",
            "title": "Form ID",
            "description": "The form identifier",
            "default": "",
            "examples": [
              "60d2cd50-1047-4164-884d-8c24fbda84bb"
            ]
          },
          "formName": {
            "$id": "#/properties/formName",
            "type": "string",
            "title": "Form Name",
            "description": "The form display name",
            "default": "",
            "examples": [
              "My Form"
            ]
          },
          "contactId": {
            "$id": "#/properties/contactId",
            "type": "string",
            "format": "uuid",
            "title": "Contact Id",
            "description": "The Id of the contact which submitted the form",
            "default": "",
            "identityType": "contact", // can be contact, visitor, user limited to 1 type per identity,
            "name": "contact" // friendly name to be used later on, in order to user that person's data "contact.firstName"
          }
        },
        "required": [
          "formId",
          "formName",
          "contactId"
        ],
        "additionalProperties": false
      }
    }
 */
  google.protobuf.Struct trigger_config = 1;
  // URL to the trigger provider service
  string base_uri = 2 [(.wix.spi.base_uri) = true];
}
