syntax = "proto3";

import "google/protobuf/wrappers.proto";
import "wix/coreservices/businessschema/v1/common.proto";
import "wix/coreservices/businessschema/v1/appendix.proto";
import "wix/api/validations.proto";

package wix.coreservices.businessschema.v1;

message Service {
  string name = 1; // Service name
  string package = 2; // Proto package
  string proto_src = 3; // Reference to proto folder in github
  string proto_artifact_id = 4; // Micro-service that implements proto service. e.g. `com.wixpress.platform.coupons-api`
  string proto_artifact_version = 5; // Micro-service revision|build-tag identifier e.g. `"2.3501.0"`
  string service_artifact_id = 6; // Service identifier. e.g. `com.wixpress.platform.couponv2`
  repeated Server servers = 7; // Actual available mappings to implementing server
  Deprecated deprecated = 8; // Deprecation info
  string description = 9; // Service description
  repeated Appendix appendices = 10; // service appendix files
  CodeOwnersTag ownership_tag = 11; // Ownership tag for the service
  google.protobuf.StringValue namespace = 12 [(.wix.api.maxLength) = 256]; // namespace of the service to avoid collision
  google.protobuf.StringValue java_package = 13 [(.wix.api.maxLength) = 256]; // Java package of the service extracted from `option java_package`
}

message Server {
  enum MappingType {
    UNKNOWN_MAPPING = 0;
    WIX_COM = 1;
    WIXAPPS_NET = 2;
    DEV_WIX_CODE_COM = 3;
    WIXSITE_COM = 4;
    SITENAME_COM = 5;
    WIXAPIS_COM = 6;
    INTERNAL_RPC = 7;
    CUSTOM = 8;
  }
  MappingType mapping_type = 1; // Mapping preset in fryingpan
  google.protobuf.StringValue source_path = 2; // Mapping source address
  google.protobuf.StringValue destination_path = 3; // Mapping destination address, if it's root ('/') it'll be ommited.
  google.protobuf.StringValue url = 4; // Optional for REST protocol
}

message CodeOwnersTag {
  string tag_name = 1 [(.wix.api.maxLength) = 256]; // Ownership tag
  repeated string owners = 2 [(.wix.api.maxSize) = 100, (.wix.api.maxLength) = 256]; // Owners list for the tag
  CodeOwnerSlackChannel slack_info = 3; // Slack channels for the service
  string main_owner = 4 [(.wix.api.maxLength) = 256]; // Main owner of the service
}

message CodeOwnerSlackChannel {
  string main = 1 [(.wix.api.maxLength) = 256]; // Main channel for the service
  string ci = 2 [(.wix.api.maxLength) = 256]; // Channel name for CI
  string urgent = 3 [(.wix.api.maxLength) = 256]; // Channel name for urgent messages
  string important = 4 [(.wix.api.maxLength) = 256]; // Channel name for important messages
  map<string, string> custom = 5; // Custom channels
}