// Copyright 2021 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.documentai.v1beta3;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/documentai/v1beta3/document_io.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3";
option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai";
option java_multiple_files = true;
option java_outer_classname = "DocumentAiProcessor";
option java_package = "com.google.cloud.documentai.v1beta3";
option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3";
option ruby_package = "Google::Cloud::DocumentAI::V1beta3";

// The first-class citizen for DocumentAI. Each processor defines how to extract
// structural information from a document.
message Processor {
  option (google.api.resource) = {
    type: "documentai.googleapis.com/Processor"
    pattern: "projects/{project}/locations/{location}/processors/{processor}"
  };

  // The possible states of the processor.
  enum State {
    // The processor is in an unspecified state.
    STATE_UNSPECIFIED = 0;

    // The processor is enabled.
    ENABLED = 1;

    // The processor is disabled.
    DISABLED = 2;

    // The processor is being enabled, will become ENABLED if successful.
    ENABLING = 3;

    // The processor is being disabled, will become DISABLED if successful.
    DISABLING = 4;

    // The processor is being created.
    CREATING = 5;

    // The processor failed during creation.
    FAILED = 6;

    // The processor is being deleted, will be removed if successful.
    DELETING = 7;
  }

  // Output only. Immutable. The resource name of the processor.
  // Format: projects/{project}/locations/{location}/processors/{processor}
  string name = 1 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.field_behavior) = OUTPUT_ONLY
  ];

  // The processor type.
  string type = 2;

  // The display name of the processor.
  string display_name = 3;

  // Output only. The state of the processor.
  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // The default processor version.
  string default_processor_version = 9;

  // Output only. Immutable. The http endpoint that can be called to invoke processing.
  string process_endpoint = 6 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // The time the processor was created.
  google.protobuf.Timestamp create_time = 7;

  // The KMS key used for encryption/decryption in CMEK scenarios.
  // See https://cloud.google.com/security-key-management.
  string kms_key_name = 8;
}
