syntax = "proto3";

import "google/api/annotations.proto";
import "wix/api/annotations.proto";
import "wix/api/entity.proto";
import "wix/api/validations.proto";

package wix.coreservices.businessschema.v1;

service ManagementService {
  option (.wix.api.service_entity).message = "wix.coreservices.businessschema.v1.Entity";
  option (.wix.api.service_maturity) = BETA;
  option (.wix.api.service_exposure) = INTERNAL;

  rpc DeleteServiceDocument (DeleteServiceDocumentRequest) returns (DeleteServiceDocumentResponse) {
    option (.wix.api.exposure) = PRIVATE;
  }

  rpc PurgeProcessedTargetsCache(PurgeProcessedTargetsCacheRequest) returns (PurgeProcessedTargetsCacheResponse) {
    option (.wix.api.exposure) = PRIVATE;
  }

  rpc PurgeProcessedTargetsCacheByProtoArtifactId(PurgeProcessedTargetsCacheByProtoArtifactIdRequest) returns (PurgeProcessedTargetsCacheByProtoArtifactIdResponse) {
    option (.wix.api.exposure) = PRIVATE;
  }

  // Attempts to delete an entity, this includes all the entity's data across all documents
  // some data might still get left behind if it's not explicitly mapped to an fqdn (i.e appendices are per proto artifact)
  rpc DeleteEntity(DeleteEntityRequest) returns (DeleteEntityResponse) {
    option (.wix.api.exposure) = PRIVATE;
  }
}

message DeleteServiceDocumentRequest {
  string proto_service_fqn = 1 [(wix.api.minLength) = 1, (wix.api.maxLength) = 256];
}

message DeleteServiceDocumentResponse {}

message PurgeProcessedTargetsCacheRequest {
  bool confirm = 1;
}

message PurgeProcessedTargetsCacheResponse {}

message DeleteEntityRequest {
  string fqdn = 1 [(wix.api.minLength) = 4, (wix.api.maxLength) = 256];
  bool confirm = 2;
}

message DeleteEntityResponse {}

message PurgeProcessedTargetsCacheByProtoArtifactIdRequest {
  string proto_artifact_id = 1 [(wix.api.minLength) = 1, (wix.api.maxLength) = 256];
}

message PurgeProcessedTargetsCacheByProtoArtifactIdResponse {
  int32 deleted_count = 1;
}