syntax = "proto3";

package com.wixpress.appservice.api.upstream.wix.calendar.events.spi.v3;

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

// Configuration for the event validation provider.
message EventValidationProviderConfig {
  // The base URI to reach the provider's service.
  .wix.common.spi.SpiBaseUri base_uri = 1;
  // List of validation targets specifying the methods to validate and optional filters.
  repeated ValidationTarget validation_targets = 2 [(.wix.api.minSize) = 1, (.wix.api.maxSize) = 10];
}

message ValidationTarget {
  // The method to validate.
  Method method = 1;

  // Optional WQL filter applied to the events for validation.      
  // Only events matching this filter will be validated.  
  // Supported event fields:
  // - `appId`
  google.protobuf.Struct filter = 2;
  
  enum Method {
    // Validate an event before creation.
    CREATE = 0;
    // Validate an event before update.
    UPDATE = 1;
    // Validate an event before cancel.
    CANCEL = 2;
  }
}