// Copyright 2020 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.visualinspection.v1beta1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/visualinspection/v1beta1/annotation.proto";
import "google/cloud/visualinspection/v1beta1/annotation_set.proto";
import "google/cloud/visualinspection/v1beta1/annotation_spec.proto";
import "google/cloud/visualinspection/v1beta1/common.proto";
import "google/cloud/visualinspection/v1beta1/dataset.proto";
import "google/cloud/visualinspection/v1beta1/geometry.proto";
import "google/cloud/visualinspection/v1beta1/image.proto";
import "google/cloud/visualinspection/v1beta1/io.proto";
import "google/cloud/visualinspection/v1beta1/labeling.proto";
import "google/cloud/visualinspection/v1beta1/model.proto";
import "google/cloud/visualinspection/v1beta1/model_evaluation.proto";
import "google/cloud/visualinspection/v1beta1/module.proto";
import "google/cloud/visualinspection/v1beta1/solution_artifact.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.VisualInspection.V1Beta1";
option php_namespace = "Google\\Cloud\\VisualInspection\\V1beta1";
option ruby_package = "Google::Cloud::VisualInspection::V1beta1";
option go_package = "google.golang.org/genproto/googleapis/cloud/visualinspection/v1beta1;visualinspection";
option java_multiple_files = true;
option java_package = "com.google.cloud.visualinspection.v1beta1";

// Visual Inspection service enables users to train and manage solutions
// for visually inspecting parts.
service VisualInspection {
  option (google.api.default_host) = "visualinspection.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Creates a solution.
  rpc CreateSolution(CreateSolutionRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*}/solutions"
      body: "solution"
    };
    option (google.api.method_signature) = "parent,solution";
    option (google.longrunning.operation_info) = {
      response_type: "Solution"
      metadata_type: "SolutionOperationMetadata"
    };
  }

  // Lists solutions.
  rpc ListSolutions(ListSolutionsRequest) returns (ListSolutionsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*}/solutions"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a solution.
  rpc GetSolution(GetSolutionRequest) returns (Solution) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/solutions/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a SolutionArtifact.
  rpc CreateSolutionArtifact(CreateSolutionArtifactRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*/solutions/*}/solutionArtifacts"
      body: "solution_artifact"
    };
    option (google.api.method_signature) = "parent,solution_artifact";
    option (google.longrunning.operation_info) = {
      response_type: "SolutionArtifact"
      metadata_type: "CreateSolutionArtifactOperationMetadata"
    };
  }

  // Lists SolutionArtifacts in a Solution.
  rpc ListSolutionArtifacts(ListSolutionArtifactsRequest)
      returns (ListSolutionArtifactsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/solutions/*}/solutionArtifacts"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a SolutionArtifact.
  rpc GetSolutionArtifact(GetSolutionArtifactRequest)
      returns (SolutionArtifact) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/solutions/*/solutionArtifacts/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Deletes a SolutionArtifact. Only the subject SolutionArtifact is affected
  // by this operation. The SolutionArtifact's Models remain unchanged.
  rpc DeleteSolutionArtifact(DeleteSolutionArtifactRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/solutions/*/solutionArtifacts/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "DeleteSolutionArtifactOperationMetadata"
    };
  }

  // Updates a SolutionArtifact.
  rpc UpdateSolutionArtifact(UpdateSolutionArtifactRequest)
      returns (SolutionArtifact) {
    option (google.api.http) = {
      patch: "/v1beta1/{solution_artifact.name=projects/*/locations/*/solutions/*/solutionArtifacts/*}"
      body: "solution_artifact"
    };
    option (google.api.method_signature) = "solution_artifact,update_mask";
  }

  // Perform batch prediction on a given SolutionArtifact.
  rpc BatchPredict(BatchPredictRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{solution_artifact=projects/*/locations/*/solutions/*/solutionArtifacts/*}:batchPredict"
      body: "*"
    };
    option (google.api.method_signature) =
        "solution_artifact, input_uri, output_gcs_dir";
    option (google.longrunning.operation_info) = {
      response_type: "BatchPredictResponse"
      metadata_type: "BatchPredictOperationMetadata"
    };
  }

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

  // Lists Datasets in a Project.
  rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*}/datasets"
    };
    option (google.api.method_signature) = "parent";
  }

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

  // Imports data to a Dataset.
  rpc ImportData(ImportDataRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{name=projects/*/locations/*/datasets/*}:importData"
      body: "*"
    };
    option (google.api.method_signature) = "name,import_configs";
    option (google.longrunning.operation_info) = {
      response_type: "ImportDataResponse"
      metadata_type: "ImportDataOperationMetadata"
    };
  }

  // Exports data from a Dataset.
  rpc ExportData(ExportDataRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{name=projects/*/locations/*/datasets/*}:exportData"
      body: "*"
    };
    option (google.api.method_signature) = "name,export_config";
    option (google.longrunning.operation_info) = {
      response_type: "ExportDataResponse"
      metadata_type: "ExportDataOperationMetadata"
    };
  }

  // Gets an Image.
  // ImportData will create images. Therefore CreateImage is omitted.
  rpc GetImage(GetImageRequest) returns (Image) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/datasets/*/images/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists Images in a Dataset.
  rpc ListImages(ListImagesRequest) returns (ListImagesResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/datasets/*}/images"
    };
    option (google.api.method_signature) = "parent";
  }

  // Creates an AnnotationSet.
  rpc CreateAnnotationSet(CreateAnnotationSetRequest) returns (AnnotationSet) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*/datasets/*}/annotationSets"
      body: "annotation_set"
    };
    option (google.api.method_signature) = "parent,annotation_set";
  }

  // Lists AnnotationSets in a Dataset.
  rpc ListAnnotationSets(ListAnnotationSetsRequest)
      returns (ListAnnotationSetsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/datasets/*}/annotationSets"
    };
    option (google.api.method_signature) = "parent";
  }

  // Creates an AnnotationSpec.
  rpc CreateAnnotationSpec(CreateAnnotationSpecRequest)
      returns (AnnotationSpec) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*/datasets/*}/annotationSpecs"
      body: "annotation_spec"
    };
    option (google.api.method_signature) = "parent,annotation_spec";
  }

  // Lists AnnotationSpecs in a dataset.
  rpc ListAnnotationSpecs(ListAnnotationSpecsRequest)
      returns (ListAnnotationSpecsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/datasets/*}/annotationSpecs"
    };
    option (google.api.method_signature) = "parent";
  }

  // Lists Annotations on an Image.
  rpc ListAnnotations(ListAnnotationsRequest)
      returns (ListAnnotationsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/datasets/*/images/*}/annotations"
    };
    option (google.api.method_signature) = "parent";
  }

  // Creates a Module.
  rpc CreateModule(CreateModuleRequest) returns (Module) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*/solutions/*}/modules"
      body: "module"
    };
    option (google.api.method_signature) = "parent,module";
  }

  // Lists Modules in a Solution.
  rpc ListModules(ListModulesRequest) returns (ListModulesResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/solutions/*}/modules"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a Module.
  rpc GetModule(GetModuleRequest) returns (Module) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/solutions/*/modules/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Deletes a Module. Only the subject Module is affected by this operation.
  // The Module's input and output AnnotationSets and any connected Modules
  // remain unchanged.
  rpc DeleteModule(DeleteModuleRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/solutions/*/modules/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "DeleteModuleOperationMetadata"
    };
  }

  // Updates a Module.
  rpc UpdateModule(UpdateModuleRequest) returns (Module) {
    option (google.api.http) = {
      patch: "/v1beta1/{module.name=projects/*/locations/*/solutions/*/modules/*}"
      body: "module"
    };
    option (google.api.method_signature) = "module,update_mask";
  }

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

  // Lists Models for a Module.
  rpc ListModels(ListModelsRequest) returns (ListModelsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/solutions/*/modules/*}/models"
    };
    option (google.api.method_signature) = "parent";
  }

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

  // Deletes a Model.
  rpc DeleteModel(DeleteModelRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/solutions/*/modules/*/models/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "DeleteModelOperationMetadata"
    };
  }

  // Updates a Model.
  rpc UpdateModel(UpdateModelRequest) returns (Model) {
    option (google.api.http) = {
      patch: "/v1beta1/{model.name=projects/*/locations/*/solutions/*/modules/*/models/*}"
      body: "model"
    };
    option (google.api.method_signature) = "model,update_mask";
  }

  // Lists ModelEvaluations for a Model. For Beta, we will have only one
  // evaluation produced when the Model is created.
  rpc ListModelEvaluations(ListModelEvaluationsRequest)
      returns (ListModelEvaluationsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*/solutions/*/modules/*/models/*}/modelEvaluations"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets a ModelEvaluation.
  rpc GetModelEvaluation(GetModelEvaluationRequest) returns (ModelEvaluation) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/solutions/*/modules/*/models/*/modelEvaluations/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Writes a Model's predictions to the parent Module's output
  // AnnotationSets.
  rpc WritePredictions(WritePredictionsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{model=projects/*/locations/*/solutions/*/modules/*/models/*}:writePredictions"
      body: "*"
    };
    option (google.api.method_signature) = "model";
    option (google.longrunning.operation_info) = {
      response_type: "WritePredictionsResponse"
      metadata_type: "WritePredictionsOperationMetadata"
    };
  }

  // Creates a SpecialistPool.
  rpc CreateSpecialistPool(CreateSpecialistPoolRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*}/specialistPools"
      body: "specialist_pool"
    };
    option (google.api.method_signature) = "parent,specialist_pool";
    option (google.longrunning.operation_info) = {
      response_type: "SpecialistPool"
      metadata_type: "CreateSpecialistPoolOperationMetadata"
    };
  }

  // Gets a SpecialistPool.
  rpc GetSpecialistPool(GetSpecialistPoolRequest) returns (SpecialistPool) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/specialistPools/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Updates a SpecialistPool.
  rpc UpdateSpecialistPool(UpdateSpecialistPoolRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1beta1/{specialist_pool.name=projects/*/locations/*/specialistPools/*}"
      body: "specialist_pool"
    };
    option (google.api.method_signature) = "specialist_pool,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "SpecialistPool"
      metadata_type: "UpdateSpecialistPoolOperationMetadata"
    };
  }

  // Lists SpecialistPools.
  rpc ListSpecialistPools(ListSpecialistPoolsRequest)
      returns (ListSpecialistPoolsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*}/specialistPools"
    };
    option (google.api.method_signature) = "parent";
  }

  // Deletes a SpecialistPool.
  rpc DeleteSpecialistPool(DeleteSpecialistPoolRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/specialistPools/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "DeleteSpecialistPoolOperationMetadata"
    };
  }

  // Creates a LabelingJob.
  rpc CreateLabelingJob(CreateLabelingJobRequest) returns (LabelingJob) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*}/labelingJobs"
      body: "labeling_job"
    };
    option (google.api.method_signature) = "parent,labeling_job";
  }

  // Gets a LabelingJob.
  rpc GetLabelingJob(GetLabelingJobRequest) returns (LabelingJob) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/labelingJobs/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists LabelingJobs.
  rpc ListLabelingJobs(ListLabelingJobsRequest)
      returns (ListLabelingJobsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*}/labelingJobs"
    };
    option (google.api.method_signature) = "parent";
  }

  // Deletes a LabelingJob.
  rpc DeleteLabelingJob(DeleteLabelingJobRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/labelingJobs/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "DeleteLabelingJobOperationMetadata"
    };
  }

  // Cancels a LabelingJob. Success of cancellation is not guaranteed.
  rpc CancelLabelingJob(CancelLabelingJobRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v1beta1/{name=projects/*/locations/*/labelingJobs/*}:cancel"
      body: "*"
    };
    option (google.api.method_signature) = "name";
  }
}

// A solution is a set of models and algorithms combined together that will
// solve a specific visual inspection problem.
message Solution {
  option (google.api.resource) = {
    type: "visualinspection.googleapis.com/Solution"
    pattern: "projects/{project}/locations/{location}/solutions/{solution}"
  };

  // Configuration specific to training parameters.
  message TrainingConfig {
    // Optional. Training time for each individual artifacts.
    google.protobuf.Duration training_duration = 1
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Structured object containing parameters to fine tune the
    // training behavior.
    google.protobuf.Struct parameters = 2
        [(google.api.field_behavior) = OPTIONAL];
  }

  // A predefined SolutionType.
  message SolutionType {
    // Options for an assembly inspection Solution.
    message AssemblyInspectionOptions {}

    // Options for cosmetic inspection Solution.
    message CosmeticInspectionOptions {}

    // Options for a custom inspection Solution.
    message CustomInspectionOptions {}

    // The predefined type of this Solution.
    oneof type {
      // Predefined solution for assembly inspection.
      AssemblyInspectionOptions assembly_inspection = 1;

      // Predefined solution for cosmetic inspection.
      CosmeticInspectionOptions cosmetic_inspection = 2;

      // Customized solution for inspection.
      CustomInspectionOptions custom_inspection = 3;
    }
  }

  // A unique name for the solution.
  // This is an alphanumeric identifier generated by the system
  // ([A-Z][A-Z0-9]+).
  string name = 1;

  // A user friendly display name for the solution.
  string display_name = 2;

  // Data input file specifies the input dataset for creating (training)
  // the solution. This must be a GCS URI path i.e. of the form
  // gs://<bucket_name>/<path to file>. The data file format is JSONL with each
  // line following the format below (also see examples for Board Inspection
  // and Cosmetic Inspection below).
  // ```
  // {
  //   # Note: Only needed for Board inspection.
  //   "golden_images": [
  //     {
  //        "template_image_gcs_uri": "GCS path to template image.",
  //        "inspection_area_and_regions": [
  //          {
  //            "inspection_area": {
  //              "inspection_area_id": "<unique id for inspection area.",
  //              "bounding_poly": {
  //                "normalized_vertices": [
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                ]
  //              }
  //            },
  //            "regions": [
  //              "bounding_poly": {
  //                "normalized_vertices": [
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                ]
  //              },
  //              "region_metadata": {
  //                "region_id": "<region id>",
  //                "region_name": "<region name>",
  //                "component_id": "<component id>",
  //                "component_name": "<component name>"
  //                "other_keywords": {
  //                  "keyword1": "value1",
  //                  "keyword2": "value2"
  //                }
  //              }
  //            ]
  //          }
  //        ]
  //      }
  //   ]
  //   # finetune_from_solution_id can be omitted.
  //   "finetune_from_solution_id": "<id of existing solution>",
  //
  //
  //   "image_and_annotations": [
  //     {
  //       "image_gcs_uri": "<path to the image.",
  //       "image_properties": {
  //         "image_property1": "value1",
  //         "image_property2": "value2"
  //       },
  //       "inspection_state":
  //
  // "INSPECTION_STATE_UNLABELED|INSPECTION_STATE_NON_DEFECTIVE|INSPECTION_STATE_DEFECTIVE",
  //
  //       # Note: Only needed for Board inspection.
  //       "region_id_and_defective_labels": [
  //         {
  //           "inspection_area_id": "<inspection area id>",
  //           "region_id": "<region id>",
  //           "inspection_state":
  //
  // "INSPECTION_STATE_UNLABELED|INSPECTION_STATE_NON_DEFECTIVE|INSPECTION_STATE_DEFECTIVE",
  //           "defect_label_name": "defect label name."
  //         }
  //       ],
  //       # Note: Only needed for Cosmetic Inspection.
  //       "localized_region": [
  //         {
  //           "bounding_poly": {
  //             "normalized_vertices": [
  //               { "x": 0.1,  "y": 0.2 },
  //               { "x": 0.1,  "y": 0.2 },
  //               { "x": 0.1,  "y": 0.2 },
  //               { "x": 0.1,  "y": 0.2 },
  //             ]
  //           },
  //           "region_metadata": {
  //             "region_id": "<region id>",
  //             "region_name": "<region name>",
  //             "component_id": "<component id>",
  //             "component_name": "<component name>"
  //             "other_keywords": {
  //               "keyword1": "value1",
  //               "keyword2": "value2"
  //             }
  //           }
  //         }
  //       ],
  //       # Note: Only needed for Cosmetic Inspection.
  //       "segmentation_annotation": {
  //         "mask": {
  //           "mask": {
  //             "gcs_uri": "<gcs path to the image.>",
  //             "class_map": {
  //               1: "scratch",
  //               2: "glue"
  //             }
  //           }
  //         }
  //       }
  //     }
  //   ]
  // }
  //
  // ```
  // Here's an example for Board Inspection.
  // {
  //   # Note: Only needed for Board inspection.
  //   "golden_images": [
  //     {
  //        "template_image_gcs_uri": "GCS path to template image.",
  //        "inspection_area_and_regions": [
  //          {
  //            "inspection_area": {
  //              "inspection_area_id": "<unique id for inspection area.",
  //              "bounding_poly": {
  //                "normalized_vertices": [
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                ]
  //              }
  //            },
  //            "regions": [
  //              "bounding_poly": {
  //                "normalized_vertices": [
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                  { "x": 0.1,  "y": 0.2 },
  //                ]
  //              },
  //              "region_metadata": {
  //                "region_id": "<region id>",
  //                "region_name": "<region name>",
  //                "component_id": "<component id>",
  //                "component_name": "<component name>"
  //                "other_keywords": {
  //                  "keyword1": "value1",
  //                  "keyword2": "value2"
  //                }
  //              }
  //            ]
  //          }
  //        ]
  //      }
  //   ]
  //   # finetune_from_solution_id can be omitted.
  //   "finetune_from_solution_id": "<id of existing solution>",
  //
  //
  //   "image_and_annotations": [
  //     {
  //       "image_gcs_uri": "<path to the image.",
  //       "image_properties": {
  //         "image_property1": "value1",
  //         "image_property2": "value2"
  //       },
  //       "inspection_state":
  //
  // "INSPECTION_STATE_UNLABELED|INSPECTION_STATE_NON_DEFECTIVE|INSPECTION_STATE_DEFECTIVE",
  //
  //       # Note: Only needed for Board inspection.
  //       "region_id_and_defective_labels": [
  //         {
  //           "inspection_area_id": "<inspection area id>",
  //           "region_id": "<region id>",
  //           "inspection_state":
  //
  // "INSPECTION_STATE_UNLABELED|INSPECTION_STATE_NON_DEFECTIVE|INSPECTION_STATE_DEFECTIVE",
  //           "defect_label_name": "defect label name."
  //         }
  //       ],
  //     }
  //   ]
  // }
  //
  // ```
  // Here's an example for Cosmetic Inspection.
  // /```
  // {
  //   # finetune_from_solution_id can be omitted.
  //   "finetune_from_solution_id": "<id of existing solution>",
  //   "image_and_annotations": [
  //     {
  //       "image_gcs_uri": "<path to the image.",
  //       "image_properties": {
  //         "image_property1": "value1",
  //         "image_property2": "value2"
  //       },
  //       "inspection_state":
  //
  // "INSPECTION_STATE_UNLABELED|INSPECTION_STATE_NON_DEFECTIVE|INSPECTION_STATE_DEFECTIVE",
  //
  //       # Note: Only needed for Cosmetic Inspection.
  //       "localized_region": [
  //         {
  //           "bounding_poly": {
  //             "normalized_vertices": [
  //               { "x": 0.1,  "y": 0.2 },
  //               { "x": 0.1,  "y": 0.2 },
  //               { "x": 0.1,  "y": 0.2 },
  //               { "x": 0.1,  "y": 0.2 },
  //             ]
  //           },
  //           "region_metadata": {
  //             "region_id": "<region id>",
  //             "region_name": "<region name>",
  //             "component_id": "<component id>",
  //             "component_name": "<component name>"
  //             "other_keywords": {
  //               "keyword1": "value1",
  //               "keyword2": "value2"
  //             }
  //           }
  //         }
  //       ],
  //       # Note: Only needed for Cosmetic Inspection.
  //       "segmentation_annotation": {
  //         "mask": {
  //           "mask": {
  //             "gcs_uri": "<gcs path to the image.>",
  //             "class_map": {
  //               1: "scratch",
  //               2: "glue"
  //             }
  //           }
  //         }
  //       }
  //     }
  //   ]
  // }
  // ```
  string gcs_data_input_uri = 3;

  // Optional. Type of the solution. Valid values are:
  // *    `assembly`: Solution for finding defects in PCB like components. This
  //                  is the default value.
  // *    `cosmetic`: Solution for finding cosmetic defects on a device.
  //                  Examples include finding scratches or dust particles on
  //                  a device.
  string type = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Solution creation train configuration.
  TrainingConfig training_config = 9 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Timestamp when the all the models in the solution were trained
  // and evaluated.
  google.protobuf.Timestamp create_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Timestamp when this solution was last updated.
  google.protobuf.Timestamp update_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. A description for this Solution.
  string description = 10 [(google.api.field_behavior) = OPTIONAL];

  // Required. The Dataset of this Solution.
  string dataset_id = 11 [(google.api.field_behavior) = REQUIRED];

  // Optional. The labels with user-defined metadata to organize your Solutions.
  //
  // Label keys and values can be no longer than 64 characters
  // (Unicode codepoints), can only contain lowercase letters, numeric
  // characters, underscores and dashes. International characters are allowed.
  // Label keys must start with a letter.
  //
  // See https://goo.gl/xmQnxf for more information on and examples of labels.
  map<string, string> labels = 12 [(google.api.field_behavior) = OPTIONAL];

  // Required. The SolutionType of this Solution. This restricts the allowable
  // Modules and the linkage between them according to predefined solution
  // schema.
  SolutionType solution_type = 13 [(google.api.field_behavior) = REQUIRED];
}

// Solution operation metadata.
message SolutionOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for creating a solution.
message CreateSolutionRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Solution"
    }
  ];

  // Required. Solution to create.
  Solution solution = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request method for listing solutions.
message ListSolutionsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Solution"
    }
  ];

  // The maximum number of solutions to return. The service may return fewer
  // than this value. If unspecified, at moast 50 solutions will be returned.
  // The maximum value is 100; values above 100 will be coerced to 100.
  int32 page_size = 2;

  // A page token, received from a previous `ListSolutions` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListSolutions` must
  // match the call that provided the page token.
  string page_token = 3;

  // The standard list filter.
  string filter = 4;
}

// Response method for listing solutions.
message ListSolutionsResponse {
  // The solutions for this project.
  repeated Solution solutions = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// For requesting details about a particular solution.
message GetSolutionRequest {
  // Required. Solution identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Solution"
    }
  ];
}

// Export solution metadata to distinguish that the operation is an export
// solution operation.
message ExportSolutionOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Deploy solution metadata to distinguish that the operation is an export
// solution operation.
message DeploySolutionOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Undeploy solution metadata to distinguish that the operation is an export
// solution operation.
message UndeploySolutionOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for creating a SolutionArtifact.
message CreateSolutionArtifactRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/SolutionArtifact"
    }
  ];

  // Required. SolutionArtifact to create.
  SolutionArtifact solution_artifact = 2
      [(google.api.field_behavior) = REQUIRED];
}

// CreateSolutionArtifact operation metadata.
message CreateSolutionArtifactOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for listing SolutionArtifacts.
message ListSolutionArtifactsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/SolutionArtifact"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of SolutionArtifacts to return. The service may return
  // fewer than this value. If unspecified, at most 20 Modules will be
  // returned. The maximum value is 100; values above 100 will be coerced to
  // 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListSolutionArtifacts` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListSolutionArtifacts`
  // must match the call that provided the page token.
  string page_token = 4;
}

// Response for ListSolutionArtifacts.
message ListSolutionArtifactsResponse {
  // The SolutionArtifact.
  repeated SolutionArtifact solution_artifacts = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for getting a SolutionArtifact.
message GetSolutionArtifactRequest {
  // Required. SolutionArtifact identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/SolutionArtifact"
    }
  ];
}

// Request for deleting a SolutionArtifact.
message DeleteSolutionArtifactRequest {
  // Required. SolutionArtifact identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/SolutionArtifact"
    }
  ];
}

// Operation metadata for DeleteSolutionArtifact.
message DeleteSolutionArtifactOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for updating a SolutionArtifact.
message UpdateSolutionArtifactRequest {
  // Required. The SolutionArtifact which replaces the resource on the server.
  SolutionArtifact solution_artifact = 1
      [(google.api.field_behavior) = REQUIRED];

  // Required. The update mask applies to the resource.
  // For the `FieldMask` definition, see
  //
  // [FieldMask](https:
  // //developers.google.com/protocol-buffers
  // // /docs/reference/google.protobuf#fieldmask).
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];
}

// CreateDataset operation metadata.
message CreateDatasetOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for getting a Dataset.
message GetDatasetRequest {
  // Required. Dataset identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Dataset"
    }
  ];
}

// Request for deleting a Dataset.
message DeleteDatasetRequest {
  // Required. Dataset identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Dataset"
    }
  ];
}

// Request for listing Datasets.
message ListDatasetsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Dataset"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of Dataset to return. The service may return fewer
  // than this value. If unspecified, at most 20 Datasets will be returned.
  // The maximum value is 100; values above 100 will be coerced to 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListDatasets` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListDatasets` must
  // match the call that provided the page token.
  string page_token = 4;
}

// Response for ListDatasets.
message ListDatasetsResponse {
  // The datasets for this project.
  repeated Dataset datasets = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for importing a Dataset.
message ImportDataRequest {
  // Required. Dataset identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Dataset"
    }
  ];

  // Required. The desired input locations. The contents of all input locations
  // will be imported in one batch.
  repeated ImportDataConfig import_configs = 2
      [(google.api.field_behavior) = REQUIRED];
}

// ImportData operation metadata.
message ImportDataOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for exporting a Dataset.
message ExportDataRequest {
  // Required. Dataset identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Dataset"
    }
  ];

  // Required. The desired output location.
  ExportDataConfig export_config = 2 [(google.api.field_behavior) = REQUIRED];
}

// ExportData operation metadata.
message ExportDataOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// DeleteDataset operation metadata.
message DeleteDatasetOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for getting an Image.
message GetImageRequest {
  // Required. Image identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Image"
    }
  ];
}

// Request for listing Images.
message ListImagesRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Image"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of images to return. The service may return fewer
  // than this value. If unspecified, at most 20 images will be returned.
  // The maximum value is 200; values above 200 will be coerced to 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListImages` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListImages` must
  // match the call that provided the page token.
  string page_token = 4;
}

// Response for ListImages.
message ListImagesResponse {
  // The images for this dataset.
  repeated Image images = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for creating a AnnotationSet.
message CreateAnnotationSetRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/AnnotationSet"
    }
  ];

  // Required. AnnotationSet to create.
  AnnotationSet annotation_set = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request for listing AnnotationSets.
message ListAnnotationSetsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/AnnotationSet"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of AnnotationSets to return. The service may return
  // fewer than this value. If unspecified, at most 20 AnnotationSets will be
  // returned. The maximum value is 100; values above 100 will be coerced to
  // 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListAnnotationSets` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListAnnotationSets` must
  // match the call that provided the page token.
  string page_token = 4;
}

// Response for ListAnnotationSets.
message ListAnnotationSetsResponse {
  // The annotationsets for this project.
  repeated AnnotationSet annotation_sets = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Operation metadata for DeleteAnnotationSet.
message DeleteAnnotationSetOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for creating a AnnotationSpec.
message CreateAnnotationSpecRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/AnnotationSpec"
    }
  ];

  // Required. AnnotationSpec to create.
  AnnotationSpec annotation_spec = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request for listing AnnotationSpecs.
message ListAnnotationSpecsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/AnnotationSpec"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of AnnotationSpecs to return. The service may return
  // fewer than this value. If unspecified, at most 20 AnnotationSpecs will be
  // returned. The maximum value is 100; values above 100 will be coerced to
  // 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListAnnotationSpecs` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListAnnotationSpecs`
  // must match the call that provided the page token.
  string page_token = 4;
}

// Response for ListAnnotationSpecs.
message ListAnnotationSpecsResponse {
  // The annotationspecs for this project.
  repeated AnnotationSpec annotation_specs = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Operation Metadata for DeleteAnnotationSpec.
message DeleteAnnotationSpecOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for listing Annotations.
message ListAnnotationsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Annotation"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of annotations to return. The service may return
  // fewer than this value. If unspecified, at most 20 annotations will be
  // returned. The maximum value is 100; values above 100 will be coerced to
  // 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListAnnotations` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListAnnotations`
  // must match the call that provided the page token.
  string page_token = 4;
}

// Response for ListAnnotations.
message ListAnnotationsResponse {
  // The annotations for this image.
  repeated Annotation annotations = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Operation metadata for DeleteAnnotation.
message DeleteAnnotationOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for creating a Module.
message CreateModuleRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Module"
    }
  ];

  // Required. Module to create.
  Module module = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request for listing Modules.
message ListModulesRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Module"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of Modules to return. The service may return
  // fewer than this value. If unspecified, at most 20 Modules will be
  // returned. The maximum value is 100; values above 100 will be coerced to
  // 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListModules` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListModules`
  // must match the call that provided the page token.
  string page_token = 4;
}

// Response for ListModules.
message ListModulesResponse {
  // The Modules.
  repeated Module modules = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for getting a Module.
message GetModuleRequest {
  // Required. Module identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Module"
    }
  ];
}

// Request for deleting a Module.
message DeleteModuleRequest {
  // Required. Module identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Module"
    }
  ];
}

// Operation metadata for DeleteModule.
message DeleteModuleOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for updating a Module.
message UpdateModuleRequest {
  // Required. The Module which replaces the resource on the server.
  Module module = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The update mask applies to the resource.
  // For the `FieldMask` definition, see
  //
  // [FieldMask](https:
  // //developers.google.com/protocol-buffers
  // // /docs/reference/google.protobuf#fieldmask).
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Request for creating a Model. This invokes the training process for
// the parent Module.
message CreateModelRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Model"
    }
  ];

  // Optional. Model to create.
  Model model = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Operation metadata for CreateModel.
message CreateModelOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for listing Models.
message ListModelsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/Model"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of Models to return. The service may return
  // fewer than this value. If unspecified, at most 20 Models will be
  // returned. The maximum value is 100; values above 100 will be coerced to
  // 100.
  int32 page_size = 3;

  // A page token, received from a previous `ListModels` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ListModels`
  // must match the call that provided the page token.
  string page_token = 4;
}

// Response for ListModels.
message ListModelsResponse {
  // The Model.
  repeated Model models = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for getting a Model.
message GetModelRequest {
  // Required. Model identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Model"
    }
  ];
}

// Request for deleting a Model.
message DeleteModelRequest {
  // Required. Model identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Model"
    }
  ];
}

// Operation metadata for DeleteModel.
message DeleteModelOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for updating a Model.
message UpdateModelRequest {
  // Required. The Model which replaces the resource on the server.
  Model model = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The update mask applies to the resource.
  // For the `FieldMask` definition, see
  //
  // [FieldMask](https:
  // //developers.google.com/protocol-buffers
  // // /docs/reference/google.protobuf#fieldmask).
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Request for listing ModelEvaluations.
message ListModelEvaluationsRequest {
  // Required. Parent identifier.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/ModelEvaluation"
    }
  ];

  // The standard list filter.
  string filter = 2;

  // The maximum number of ModelEvaluations to return. The service may return
  // fewer than this value. If unspecified, at most 20 ModelEvaluations will be
  // returned. The maximum value is 100; values above 100 will be coerced to
  // 100.
  int32 page_size = 3;

  // A page token, received from a previous `ModelEvaluations` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to `ModelEvaluations`
  // must match the call that provided the page token.
  string page_token = 4;
}

// Response for ListModelEvaluations.
message ListModelEvaluationsResponse {
  // The ModelEvaluation.
  repeated ModelEvaluation model_evaluations = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for getting a ModelEvaluation.
message GetModelEvaluationRequest {
  // Required. ModelEvaluation identifier.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/ModelEvaluation"
    }
  ];
}

// Request for enriching the Dataset with predicted Annotations from a
// Model.
message WritePredictionsRequest {
  // Required. Model identifier.
  string model = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/Model"
    }
  ];

  // A score threshold in the range [0, 1] to filter output Annotations. If set,
  // only Annotations with at least this score will be saved in the output
  // AnnotationSet. Otherwise a default value will be used based on the Module.
  float output_score_threshold = 2;

  // An IOU (intersection over union) threshold in the range [0, 1] to use for
  // matching Annotations for some Module types. New Annotations must have at
  // least this IOU in in relation to an old Anotation to be considered
  // matching. If not provided, a default value will be used based on the
  // Module.
  float output_matching_iou_threshold = 3;

  // By default WritePredictions copies all Annotation labels from old
  // Annotations to new Annotations. These fields give finer control over which
  // label keys to copy. If provided, only keys in this list will be copied.
  repeated string label_keys_copy_allowlist = 4;

  // If provided, no keys in this list will be copied, even if they appear
  // in the allowlist.
  repeated string label_keys_copy_denylist = 5;
}

// Operation metadata for WritePredictions.
message WritePredictionsOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for creating a SpecialistPool.
message CreateSpecialistPoolRequest {
  // Required. The parent Project name for the new SpecialistPool.
  // The form is `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/SpecialistPool"
    }
  ];

  // Required. The SpecialistPool to create.
  SpecialistPool specialist_pool = 2 [(google.api.field_behavior) = REQUIRED];
}

// Operation metadata for CreateSpecialistPool.
message CreateSpecialistPoolOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for getting a SpecialistPool.
message GetSpecialistPoolRequest {
  // Required. The name of the SpecialistPool resource.
  // The form is
  //
  // `projects/{project}/locations/{location}/specialistPools/{specialist_pool}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/SpecialistPool"
    }
  ];
}

// Request for updating a SpecialistPool.
message UpdateSpecialistPoolRequest {
  // Required. The SpecialistPool which replaces the resource on the server.
  SpecialistPool specialist_pool = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The update mask applies to the resource.
  // For the `FieldMask` definition, see
  //
  // [FieldMask](https:
  // //developers.google.com/protocol-buffers
  // // /docs/reference/google.protobuf#fieldmask).
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Operation metadata for UpdateSpecialistPool.
message UpdateSpecialistPoolOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for listing SpecialistPools.
message ListSpecialistPoolsRequest {
  // Required. The name of the SpecialistPool's parent resource.
  // Format: `projects/{project}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/SpecialistPool"
    }
  ];

  // The number of SpecialistPools to return.
  int32 page_size = 2;

  // A page token, received from a previous `ListSpecialistPoolsRequest` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to
  // `ListSpecialistPoolsRequest` must match the call that provided the page
  // token.
  string page_token = 3;

  // The standard list filter.
  string filter = 4;
}

// Response message for ListSpecialistPools.
message ListSpecialistPoolsResponse {
  // A list of SpecialistPools that matches the specified filter in the request.
  repeated SpecialistPool specialist_pools = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for deleting a specialist pool.
message DeleteSpecialistPoolRequest {
  // Required. The resource name of the SpecialistPool to delete. Format:
  //
  // `projects/{project}/locations/{location}/specialistPools/{specialist_pool}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/SpecialistPool"
    }
  ];
}

// Operation metadata for DeleteSpecialistPool.
message DeleteSpecialistPoolOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request for creating a labeling job.
message CreateLabelingJobRequest {
  // Required. The parent of the LabelingJob.
  // Format: `projects/{project}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/LabelingJob"
    }
  ];

  // Required. The LabelingJob to create.
  LabelingJob labeling_job = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request for getting a labeling job.
message GetLabelingJobRequest {
  // Required. The name of the LabelingJob.
  // Format:
  // `projects/{project}/locations/{location}/labelingJobs/{labeling_job}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/LabelingJob"
    }
  ];
}

// Request message for listing labeling jobs.
message ListLabelingJobsRequest {
  // Required. The name of the LabelingJob's parent resource.
  // Format: `projects/{project}/locations/{location}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "visualinspection.googleapis.com/LabelingJob"
    }
  ];

  // The number of labeling jobs to return.
  int32 page_size = 2;

  // A page token, received from a previous `ListLabelingJobsRequest` call.
  // Provide this to retrieve the subsequent page.
  //
  // When paginating, all other parameters provided to
  // `ListLabelingJobsRequest` must match the call that provided the page
  // token.
  string page_token = 3;

  // The standard list filter.
  string filter = 4;
}

// Response message for listing labeling jobs.
message ListLabelingJobsResponse {
  // A list of SpecialistPools that matches the specified filter in the request.
  repeated LabelingJob labeling_jobs = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request for deleting a labeling job.
message DeleteLabelingJobRequest {
  // Required. The resource name of the labeling job to delete. Format:
  // `projects/{project}/locations/{location}/labelingJobs/{labeling_job}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/LabelingJob"
    }
  ];
}

// Operation metadata for deleting a labeling job.
message DeleteLabelingJobOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for cancelling a labeling job.
message CancelLabelingJobRequest {
  // Required. The resource name of the labeling job to cancel. Format:
  // `projects/{project}/locations/{location}/labelingJobs/{labeling_job}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/LabelingJob"
    }
  ];
}

// Request message for BatchPredict.
message BatchPredictRequest {
  // Required. SolutionArtifact identifier.
  string solution_artifact = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "visualinspection.googleapis.com/SolutionArtifact"
    }
  ];

  // Required. The input configuration for batch prediction.
  // The Cloud Storage path of input file. Accepted forms:
  // * Full object path, e.g. gs://bucket/directory/object.csv in which each
  // line is the full path to a image file.
  string input_uri = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The Cloud Storage location of the directory where the output is
  // to be written to. Output directory will contain:
  // 1. output.jsonl
  // # Each line is a JSON format of PredictionResult.
  //
  // 2. category_masks (for MaskAnnotation)
  // # Directory of masks - referenced via annotation in output.jsonl.
  //
  // 3. confidence_masks (for MaskAnnotation)
  // # Directory of masks - referenced via annotation in output.jsonl.
  GcsDestination output_gcs_dir = 3 [(google.api.field_behavior) = REQUIRED];
}

// Operation metadata for BatchPreidct.
message BatchPredictOperationMetadata {
  // Output only. Common operation metadata.
  CommonOperationMetadata common_operation_metadata = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

message BatchPredictResponse {}

message ExportDataResponse {}

message ImportDataResponse {}

message WritePredictionsResponse {}
