// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.financialservices.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/cloud/financialservices/v1/backtest_result.proto";
import "google/cloud/financialservices/v1/dataset.proto";
import "google/cloud/financialservices/v1/engine_config.proto";
import "google/cloud/financialservices/v1/engine_version.proto";
import "google/cloud/financialservices/v1/instance.proto";
import "google/cloud/financialservices/v1/model.proto";
import "google/cloud/financialservices/v1/prediction_result.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.FinancialServices.V1";
option go_package = "cloud.google.com/go/financialservices/apiv1/financialservicespb;financialservicespb";
option java_multiple_files = true;
option java_outer_classname = "ServiceProto";
option java_package = "com.google.cloud.financialservices.v1";
option php_namespace = "Google\\Cloud\\FinancialServices\\V1";
option ruby_package = "Google::Cloud::FinancialServices::V1";

// The AML (Anti Money Laundering) service allows users to perform REST
// operations on aml.
service AML {
  option (google.api.default_host) = "financialservices.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists instances.
  rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/instances"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets an instance.
  rpc GetInstance(GetInstanceRequest) returns (Instance) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/instances/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates an instance.
  rpc CreateInstance(CreateInstanceRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/instances"
      body: "instance"
    };
    option (google.api.method_signature) = "parent,instance,instance_id";
    option (google.longrunning.operation_info) = {
      response_type: "Instance"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single Instance.
  rpc UpdateInstance(UpdateInstanceRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{instance.name=projects/*/locations/*/instances/*}"
      body: "instance"
    };
    option (google.api.method_signature) = "instance,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Instance"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes an instance.
  rpc DeleteInstance(DeleteInstanceRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/instances/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Imports the list of registered parties. See
  // [Create and manage
  // instances](https://cloud.google.com/financial-services/anti-money-laundering/docs/create-and-manage-instances#import-registered-parties)
  // for information on the input schema and response for this method.
  rpc ImportRegisteredParties(ImportRegisteredPartiesRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/instances/*}:importRegisteredParties"
      body: "*"
    };
    option (google.api.method_signature) =
        "name,mode,line_of_business,party_tables";
    option (google.longrunning.operation_info) = {
      response_type: "ImportRegisteredPartiesResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Exports the list of registered parties. See
  // [Create and manage
  // instances](https://cloud.google.com/financial-services/anti-money-laundering/docs/create-and-manage-instances#export-registered-parties)
  // for information on the output schema for this method.
  rpc ExportRegisteredParties(ExportRegisteredPartiesRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/instances/*}:exportRegisteredParties"
      body: "*"
    };
    option (google.api.method_signature) = "name,dataset,line_of_business";
    option (google.longrunning.operation_info) = {
      response_type: "ExportRegisteredPartiesResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists datasets.
  rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/instances/*}/datasets"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a dataset.
  rpc GetDataset(GetDatasetRequest) returns (Dataset) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/instances/*/datasets/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a dataset.
  rpc CreateDataset(CreateDatasetRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/instances/*}/datasets"
      body: "dataset"
    };
    option (google.api.method_signature) = "parent,dataset,dataset_id";
    option (google.longrunning.operation_info) = {
      response_type: "Dataset"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single Dataset.
  rpc UpdateDataset(UpdateDatasetRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{dataset.name=projects/*/locations/*/instances/*/datasets/*}"
      body: "dataset"
    };
    option (google.api.method_signature) = "dataset,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Dataset"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a dataset.
  rpc DeleteDataset(DeleteDatasetRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/instances/*/datasets/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists models.
  rpc ListModels(ListModelsRequest) returns (ListModelsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/instances/*}/models"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a model.
  rpc GetModel(GetModelRequest) returns (Model) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/instances/*/models/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a model.
  rpc CreateModel(CreateModelRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/instances/*}/models"
      body: "model"
    };
    option (google.api.method_signature) = "parent,model,model_id";
    option (google.longrunning.operation_info) = {
      response_type: "Model"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single Model.
  rpc UpdateModel(UpdateModelRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{model.name=projects/*/locations/*/instances/*/models/*}"
      body: "model"
    };
    option (google.api.method_signature) = "model,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Model"
      metadata_type: "OperationMetadata"
    };
  }

  // Export governance information for a Model resource. For
  // information on the exported fields, see
  // [AML output data
  // model](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#model).
  rpc ExportModelMetadata(ExportModelMetadataRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{model=projects/*/locations/*/instances/*/models/*}:exportMetadata"
      body: "*"
    };
    option (google.api.method_signature) =
        "model,structured_metadata_destination";
    option (google.longrunning.operation_info) = {
      response_type: "ExportModelMetadataResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a model.
  rpc DeleteModel(DeleteModelRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/instances/*/models/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists engine configs.
  rpc ListEngineConfigs(ListEngineConfigsRequest)
      returns (ListEngineConfigsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/instances/*}/engineConfigs"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets an engine config.
  rpc GetEngineConfig(GetEngineConfigRequest) returns (EngineConfig) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/instances/*/engineConfigs/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates an engine config.
  rpc CreateEngineConfig(CreateEngineConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/instances/*}/engineConfigs"
      body: "engine_config"
    };
    option (google.api.method_signature) =
        "parent,engine_config,engine_config_id";
    option (google.longrunning.operation_info) = {
      response_type: "EngineConfig"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single EngineConfig.
  rpc UpdateEngineConfig(UpdateEngineConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{engine_config.name=projects/*/locations/*/instances/*/engineConfigs/*}"
      body: "engine_config"
    };
    option (google.api.method_signature) = "engine_config,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "EngineConfig"
      metadata_type: "OperationMetadata"
    };
  }

  // Export governance information for an EngineConfig resource. For
  // information on the exported fields, see
  // [AML output data
  // model](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#engine-config).
  rpc ExportEngineConfigMetadata(ExportEngineConfigMetadataRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{engine_config=projects/*/locations/*/instances/*/engineConfigs/*}:exportMetadata"
      body: "*"
    };
    option (google.api.method_signature) =
        "engine_config,structured_metadata_destination";
    option (google.longrunning.operation_info) = {
      response_type: "ExportEngineConfigMetadataResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes an engine config.
  rpc DeleteEngineConfig(DeleteEngineConfigRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/instances/*/engineConfigs/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Gets a single EngineVersion.
  rpc GetEngineVersion(GetEngineVersionRequest) returns (EngineVersion) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/instances/*/engineVersions/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists EngineVersions for given location.
  rpc ListEngineVersions(ListEngineVersionsRequest)
      returns (ListEngineVersionsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/instances/*}/engineVersions"
    };
    option (google.api.method_signature) = "parent";
  }

  // List PredictionResults.
  rpc ListPredictionResults(ListPredictionResultsRequest)
      returns (ListPredictionResultsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/instances/*}/predictionResults"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a PredictionResult.
  rpc GetPredictionResult(GetPredictionResultRequest)
      returns (PredictionResult) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/instances/*/predictionResults/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Create a PredictionResult.
  rpc CreatePredictionResult(CreatePredictionResultRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/instances/*}/predictionResults"
      body: "prediction_result"
    };
    option (google.api.method_signature) =
        "parent,prediction_result,prediction_result_id";
    option (google.longrunning.operation_info) = {
      response_type: "PredictionResult"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single PredictionResult.
  rpc UpdatePredictionResult(UpdatePredictionResultRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{prediction_result.name=projects/*/locations/*/instances/*/predictionResults/*}"
      body: "prediction_result"
    };
    option (google.api.method_signature) = "prediction_result,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "PredictionResult"
      metadata_type: "OperationMetadata"
    };
  }

  // Export governance information for a PredictionResult resource. For
  // information on the exported fields, see
  // [AML output data
  // model](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#prediction-results).
  rpc ExportPredictionResultMetadata(ExportPredictionResultMetadataRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{prediction_result=projects/*/locations/*/instances/*/predictionResults/*}:exportMetadata"
      body: "*"
    };
    option (google.api.method_signature) =
        "prediction_result,structured_metadata_destination";
    option (google.longrunning.operation_info) = {
      response_type: "ExportPredictionResultMetadataResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a PredictionResult.
  rpc DeletePredictionResult(DeletePredictionResultRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/instances/*/predictionResults/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // List BacktestResults.
  rpc ListBacktestResults(ListBacktestResultsRequest)
      returns (ListBacktestResultsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/instances/*}/backtestResults"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a BacktestResult.
  rpc GetBacktestResult(GetBacktestResultRequest) returns (BacktestResult) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/instances/*/backtestResults/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Create a BacktestResult.
  rpc CreateBacktestResult(CreateBacktestResultRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/instances/*}/backtestResults"
      body: "backtest_result"
    };
    option (google.api.method_signature) =
        "parent,backtest_result,backtest_result_id";
    option (google.longrunning.operation_info) = {
      response_type: "BacktestResult"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single BacktestResult.
  rpc UpdateBacktestResult(UpdateBacktestResultRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{backtest_result.name=projects/*/locations/*/instances/*/backtestResults/*}"
      body: "backtest_result"
    };
    option (google.api.method_signature) = "backtest_result,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "BacktestResult"
      metadata_type: "OperationMetadata"
    };
  }

  // Export governance information for a BacktestResult resource. For
  // information on the exported fields, see
  // [AML output data
  // model](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#backtest-results).
  rpc ExportBacktestResultMetadata(ExportBacktestResultMetadataRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{backtest_result=projects/*/locations/*/instances/*/backtestResults/*}:exportMetadata"
      body: "*"
    };
    option (google.api.method_signature) =
        "backtest_result,structured_metadata_destination";
    option (google.longrunning.operation_info) = {
      response_type: "ExportBacktestResultMetadataResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a BacktestResult.
  rpc DeleteBacktestResult(DeleteBacktestResultRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/instances/*/backtestResults/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }
}

// Represents the metadata of the long-running operation.
message OperationMetadata {
  // Output only. The time the operation was created.
  google.protobuf.Timestamp create_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time the operation finished running.
  google.protobuf.Timestamp end_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Server-defined resource path for the target of the operation.
  // format: "/projects/{project}/..."
  // VPC-SC restrictions apply.
  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Name of the verb executed by the operation.
  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Human-readable status of the operation, if any.
  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Identifies whether the user has requested cancellation of the
  // operation.
  //
  // Successfully cancelled operations have a [Operation.error][] value
  // with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding
  // to `Code.CANCELLED`.
  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. API version used to start the operation.
  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}
