syntax = "proto3";

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

package wix.coreservices.businessschema.v1;

enum DomainEventType {
  NOT_DOMAIN_EVENT = 0;
  CREATED = 1;
  UPDATED = 2;
  DELETED = 3;
  CUSTOM_ACTION = 4;
}

enum Exposure {
  PRIVATE = 0; // Unexposed. to be used by dev team only
  INTERNAL = 1; // Exposed internally
  PUBLIC = 2; // Exposed to the world
}

enum Maturity {
  ALPHA = 0; // Immature. subject to breaking changes
  BETA = 1; // Ready for integration. 2 weeks notice before breaking changes are applied
  GA = 2; // Matured. breaking changes are not acceptable. 3 month notice before sunset
  NOT_IMPLEMENTED = 3; // Not yet implemented
}

// segment of domain events
message Segment {
  enum Segment {
    UNSPECIFIED = 0; // currently means "auto-resolved for old topics", will be forbidden when legacy cluster is removed

    /**
     * For events that are consumed in 42 and uw2 only.
     * This also includes a case where an event is produced from 84/AE1 via toMainDC
     */
    USERS = 1;

    /**
     * For events that are consumed in all DCs.
     * This includes both cases where an event is published from 84/AE1 and cases where it's published from 42/uw2 and replicated via Raven to 84/AE1
     */
    PUBLIC = 2;

    /**
     * For DevEx services/migrations.
     * Deployed on 42, uw2.
     */
    OTHERS = 3;
  }
}

// resource is deprecated
message Deprecated {
  google.protobuf.StringValue message = 1; // Deprecation message
  google.protobuf.StringValue replaced_by = 2; // Replacement resource
  google.protobuf.StringValue target_removal_date = 3 [(.wix.api.format) = LOCAL_DATE]; // Sunset date

  oneof event_identifier {
    DomainEventType event_type = 4;
    google.protobuf.StringValue payload = 5;
    google.protobuf.StringValue custom_slug = 6;
  }
}
