// 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.securesourcemanager.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/iam/v1/iam_policy.proto";
import "google/iam/v1/policy.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.SecureSourceManager.V1";
option go_package = "cloud.google.com/go/securesourcemanager/apiv1/securesourcemanagerpb;securesourcemanagerpb";
option java_multiple_files = true;
option java_outer_classname = "SecureSourceManagerProto";
option java_package = "com.google.cloud.securesourcemanager.v1";
option php_namespace = "Google\\Cloud\\SecureSourceManager\\V1";
option ruby_package = "Google::Cloud::SecureSourceManager::V1";
option (google.api.resource_definition) = {
  type: "cloudkms.googleapis.com/CryptoKey"
  pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
};
option (google.api.resource_definition) = {
  type: "privateca.googleapis.com/CaPool"
  pattern: "projects/{project}/locations/{location}/caPools/{ca_pool}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/ServiceAttachment"
  pattern: "projects/{project}/regions/{region}/serviceAttachments/{service_attachment}"
};

// Secure Source Manager API
//
// Access Secure Source Manager instances, resources, and repositories.
service SecureSourceManager {
  option (google.api.default_host) = "securesourcemanager.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

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

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

  // Creates a new instance in a given project and location.
  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"
    };
  }

  // Deletes a single 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"
    };
  }

  // Lists Repositories in a given project and location.
  //
  // The instance field is required in the query parameter for requests using
  // the securesourcemanager.googleapis.com endpoint.
  rpc ListRepositories(ListRepositoriesRequest)
      returns (ListRepositoriesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*}/repositories"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets metadata of a repository.
  rpc GetRepository(GetRepositoryRequest) returns (Repository) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new repository in a given project and location.
  //
  // The Repository.Instance field is required in the request body for requests
  // using the securesourcemanager.googleapis.com endpoint.
  rpc CreateRepository(CreateRepositoryRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*}/repositories"
      body: "repository"
    };
    option (google.api.method_signature) = "parent,repository,repository_id";
    option (google.longrunning.operation_info) = {
      response_type: "Repository"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the metadata of a repository.
  rpc UpdateRepository(UpdateRepositoryRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{repository.name=projects/*/locations/*/repositories/*}"
      body: "repository"
    };
    option (google.api.method_signature) = "repository,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Repository"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a Repository.
  rpc DeleteRepository(DeleteRepositoryRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/repositories/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists hooks in a given repository.
  rpc ListHooks(ListHooksRequest) returns (ListHooksResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/repositories/*}/hooks"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets metadata of a hook.
  rpc GetHook(GetHookRequest) returns (Hook) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*/hooks/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new hook in a given repository.
  rpc CreateHook(CreateHookRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*}/hooks"
      body: "hook"
    };
    option (google.api.method_signature) = "parent,hook,hook_id";
    option (google.longrunning.operation_info) = {
      response_type: "Hook"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the metadata of a hook.
  rpc UpdateHook(UpdateHookRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{hook.name=projects/*/locations/*/repositories/*/hooks/*}"
      body: "hook"
    };
    option (google.api.method_signature) = "hook,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Hook"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a Hook.
  rpc DeleteHook(DeleteHookRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/repositories/*/hooks/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Get IAM policy for a repository.
  rpc GetIamPolicyRepo(google.iam.v1.GetIamPolicyRequest)
      returns (google.iam.v1.Policy) {
    option (google.api.http) = {
      get: "/v1/{resource=projects/*/locations/*/repositories/*}:getIamPolicy"
    };
    option (google.api.method_signature) = "resource";
  }

  // Set IAM policy on a repository.
  rpc SetIamPolicyRepo(google.iam.v1.SetIamPolicyRequest)
      returns (google.iam.v1.Policy) {
    option (google.api.http) = {
      post: "/v1/{resource=projects/*/locations/*/repositories/*}:setIamPolicy"
      body: "*"
    };
    option (google.api.method_signature) = "resource";
  }

  // Test IAM permissions on a repository.
  // IAM permission checks are not required on this method.
  rpc TestIamPermissionsRepo(google.iam.v1.TestIamPermissionsRequest)
      returns (google.iam.v1.TestIamPermissionsResponse) {
    option (google.api.http) = {
      post: "/v1/{resource=projects/*/locations/*/repositories/*}:testIamPermissions"
      body: "*"
    };
    option (google.api.method_signature) = "resource";
  }

  // CreateBranchRule creates a branch rule in a given repository.
  rpc CreateBranchRule(CreateBranchRuleRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*}/branchRules"
      body: "branch_rule"
    };
    option (google.api.method_signature) = "parent,branch_rule,branch_rule_id";
    option (google.longrunning.operation_info) = {
      response_type: "BranchRule"
      metadata_type: "OperationMetadata"
    };
  }

  // ListBranchRules lists branch rules in a given repository.
  rpc ListBranchRules(ListBranchRulesRequest)
      returns (ListBranchRulesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/repositories/*}/branchRules"
    };
    option (google.api.method_signature) = "parent";
  }

  // GetBranchRule gets a branch rule.
  rpc GetBranchRule(GetBranchRuleRequest) returns (BranchRule) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*/branchRules/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // UpdateBranchRule updates a branch rule.
  rpc UpdateBranchRule(UpdateBranchRuleRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{branch_rule.name=projects/*/locations/*/repositories/*/branchRules/*}"
      body: "branch_rule"
    };
    option (google.api.method_signature) = "branch_rule,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "BranchRule"
      metadata_type: "OperationMetadata"
    };
  }

  // DeleteBranchRule deletes a branch rule.
  rpc DeleteBranchRule(DeleteBranchRuleRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/repositories/*/branchRules/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Creates a pull request.
  rpc CreatePullRequest(CreatePullRequestRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*}/pullRequests"
      body: "pull_request"
    };
    option (google.api.method_signature) = "parent,pull_request";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.PullRequest"
      metadata_type: "OperationMetadata"
    };
  }

  // Gets a pull request.
  rpc GetPullRequest(GetPullRequestRequest) returns (PullRequest) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*/pullRequests/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists pull requests in a repository.
  rpc ListPullRequests(ListPullRequestsRequest)
      returns (ListPullRequestsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/repositories/*}/pullRequests"
    };
    option (google.api.method_signature) = "parent";
  }

  // Updates a pull request.
  rpc UpdatePullRequest(UpdatePullRequestRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{pull_request.name=projects/*/locations/*/repositories/*/pullRequests/*}"
      body: "pull_request"
    };
    option (google.api.method_signature) = "pull_request,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.PullRequest"
      metadata_type: "OperationMetadata"
    };
  }

  // Merges a pull request.
  rpc MergePullRequest(MergePullRequestRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/repositories/*/pullRequests/*}:merge"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.PullRequest"
      metadata_type: "OperationMetadata"
    };
  }

  // Opens a pull request.
  rpc OpenPullRequest(OpenPullRequestRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/repositories/*/pullRequests/*}:open"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.PullRequest"
      metadata_type: "OperationMetadata"
    };
  }

  // Closes a pull request without merging.
  rpc ClosePullRequest(ClosePullRequestRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/repositories/*/pullRequests/*}:close"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.PullRequest"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists a pull request's file diffs.
  rpc ListPullRequestFileDiffs(ListPullRequestFileDiffsRequest)
      returns (ListPullRequestFileDiffsResponse) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*/pullRequests/*}:listFileDiffs"
    };
    option (google.api.method_signature) = "name";
  }

  // Fetches a tree from a repository.
  rpc FetchTree(FetchTreeRequest) returns (FetchTreeResponse) {
    option (google.api.http) = {
      get: "/v1/{repository=projects/*/locations/*/repositories/*}:fetchTree"
    };
  }

  // Fetches a blob from a repository.
  rpc FetchBlob(FetchBlobRequest) returns (FetchBlobResponse) {
    option (google.api.http) = {
      get: "/v1/{repository=projects/*/locations/*/repositories/*}:fetchBlob"
    };
  }

  // Creates an issue.
  rpc CreateIssue(CreateIssueRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*}/issues"
      body: "issue"
    };
    option (google.api.method_signature) = "parent,issue";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.Issue"
      metadata_type: "OperationMetadata"
    };
  }

  // Gets an issue.
  rpc GetIssue(GetIssueRequest) returns (Issue) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*/issues/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists issues in a repository.
  rpc ListIssues(ListIssuesRequest) returns (ListIssuesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/repositories/*}/issues"
    };
    option (google.api.method_signature) = "parent";
  }

  // Updates a issue.
  rpc UpdateIssue(UpdateIssueRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{issue.name=projects/*/locations/*/repositories/*/issues/*}"
      body: "issue"
    };
    option (google.api.method_signature) = "issue,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.Issue"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes an issue.
  rpc DeleteIssue(DeleteIssueRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/repositories/*/issues/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Opens an issue.
  rpc OpenIssue(OpenIssueRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/repositories/*/issues/*}:open"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.Issue"
      metadata_type: "OperationMetadata"
    };
  }

  // Closes an issue.
  rpc CloseIssue(CloseIssueRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{name=projects/*/locations/*/repositories/*/issues/*}:close"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.Issue"
      metadata_type: "OperationMetadata"
    };
  }

  // Gets a pull request comment.
  rpc GetPullRequestComment(GetPullRequestCommentRequest)
      returns (PullRequestComment) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*/pullRequests/*/pullRequestComments/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists pull request comments.
  rpc ListPullRequestComments(ListPullRequestCommentsRequest)
      returns (ListPullRequestCommentsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/repositories/*/pullRequests/*}/pullRequestComments"
    };
    option (google.api.method_signature) = "parent";
  }

  // Creates a pull request comment. This function is used to create a single
  // PullRequestComment of type Comment, or a single PullRequestComment of type
  // Code that's replying to another PullRequestComment of type Code. Use
  // BatchCreatePullRequestComments to create multiple PullRequestComments for
  // code reviews.
  rpc CreatePullRequestComment(CreatePullRequestCommentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*/pullRequests/*}/pullRequestComments"
      body: "pull_request_comment"
    };
    option (google.api.method_signature) = "parent,pull_request_comment";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.PullRequestComment"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates a pull request comment.
  rpc UpdatePullRequestComment(UpdatePullRequestCommentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{pull_request_comment.name=projects/*/locations/*/repositories/*/pullRequests/*/pullRequestComments/*}"
      body: "pull_request_comment"
    };
    option (google.api.method_signature) = "pull_request_comment,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.PullRequestComment"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a pull request comment.
  rpc DeletePullRequestComment(DeletePullRequestCommentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/repositories/*/pullRequests/*/pullRequestComments/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Batch creates pull request comments. This function is used to create
  // multiple PullRequestComments for code review. There needs to be exactly one
  // PullRequestComment of type Review, and at most 100 PullRequestComments of
  // type Code per request. The Postition of the code comments must be unique
  // within the request.
  rpc BatchCreatePullRequestComments(BatchCreatePullRequestCommentsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*/pullRequests/*}/pullRequestComments:batchCreate"
      body: "*"
    };
    option (google.api.method_signature) = "parent,requests";
    option (google.longrunning.operation_info) = {
      response_type: "BatchCreatePullRequestCommentsResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Resolves pull request comments. A list of PullRequestComment names must be
  // provided. The PullRequestComment names must be in the same conversation
  // thread. If auto_fill is set, all comments in the conversation thread will
  // be resolved.
  rpc ResolvePullRequestComments(ResolvePullRequestCommentsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*/pullRequests/*}/pullRequestComments:resolve"
      body: "*"
    };
    option (google.api.method_signature) = "parent,names";
    option (google.longrunning.operation_info) = {
      response_type: "ResolvePullRequestCommentsResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Unresolves pull request comments. A list of PullRequestComment names must
  // be provided. The PullRequestComment names must be in the same conversation
  // thread. If auto_fill is set, all comments in the conversation thread will
  // be unresolved.
  rpc UnresolvePullRequestComments(UnresolvePullRequestCommentsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*/pullRequests/*}/pullRequestComments:unresolve"
      body: "*"
    };
    option (google.api.method_signature) = "parent,names";
    option (google.longrunning.operation_info) = {
      response_type: "UnresolvePullRequestCommentsResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Creates an issue comment.
  rpc CreateIssueComment(CreateIssueCommentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1/{parent=projects/*/locations/*/repositories/*/issues/*}/issueComments"
      body: "issue_comment"
    };
    option (google.api.method_signature) = "parent,issue_comment";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.IssueComment"
      metadata_type: "OperationMetadata"
    };
  }

  // Gets an issue comment.
  rpc GetIssueComment(GetIssueCommentRequest) returns (IssueComment) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/locations/*/repositories/*/issues/*/issueComments/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists comments in an issue.
  rpc ListIssueComments(ListIssueCommentsRequest)
      returns (ListIssueCommentsResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=projects/*/locations/*/repositories/*/issues/*}/issueComments"
    };
    option (google.api.method_signature) = "parent";
  }

  // Updates an issue comment.
  rpc UpdateIssueComment(UpdateIssueCommentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1/{issue_comment.name=projects/*/locations/*/repositories/*/issues/*/issueComments/*}"
      body: "issue_comment"
    };
    option (google.api.method_signature) = "issue_comment,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.securesourcemanager.v1.IssueComment"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes an issue comment.
  rpc DeleteIssueComment(DeleteIssueCommentRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1/{name=projects/*/locations/*/repositories/*/issues/*/issueComments/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }
}

// A resource that represents a Secure Source Manager instance.
message Instance {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/Instance"
    pattern: "projects/{project}/locations/{location}/instances/{instance}"
    style: DECLARATIVE_FRIENDLY
  };

  // Secure Source Manager instance state.
  enum State {
    // Not set. This should only be the case for incoming requests.
    STATE_UNSPECIFIED = 0;

    // Instance is being created.
    CREATING = 1;

    // Instance is ready.
    ACTIVE = 2;

    // Instance is being deleted.
    DELETING = 3;

    // Instance is paused.
    PAUSED = 4;

    // Instance is unknown, we are not sure if it's functioning.
    UNKNOWN = 6;
  }

  // Provides information about the current instance state.
  enum StateNote {
    // STATE_NOTE_UNSPECIFIED as the first value of State.
    STATE_NOTE_UNSPECIFIED = 0;

    // CMEK access is unavailable.
    PAUSED_CMEK_UNAVAILABLE = 1;

    // INSTANCE_RESUMING indicates that the instance was previously paused
    // and is under the process of being brought back.
    INSTANCE_RESUMING = 2 [deprecated = true];
  }

  // HostConfig has different instance endpoints.
  message HostConfig {
    // Output only. HTML hostname.
    string html = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. API hostname.
    string api = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. Git HTTP hostname.
    string git_http = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. Git SSH hostname.
    string git_ssh = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // PrivateConfig includes settings for private instance.
  message PrivateConfig {
    // Required. Immutable. Indicate if it's private instance.
    bool is_private = 1 [
      (google.api.field_behavior) = IMMUTABLE,
      (google.api.field_behavior) = REQUIRED
    ];

    // Optional. Immutable. CA pool resource, resource must in the format of
    // `projects/{project}/locations/{location}/caPools/{ca_pool}`.
    string ca_pool = 2 [
      (google.api.field_behavior) = IMMUTABLE,
      (google.api.field_behavior) = OPTIONAL,
      (google.api.resource_reference) = {
        type: "privateca.googleapis.com/CaPool"
      }
    ];

    // Output only. Service Attachment for HTTP, resource is in the format of
    // `projects/{project}/regions/{region}/serviceAttachments/{service_attachment}`.
    string http_service_attachment = 3 [
      (google.api.field_behavior) = OUTPUT_ONLY,
      (google.api.resource_reference) = {
        type: "compute.googleapis.com/ServiceAttachment"
      }
    ];

    // Output only. Service Attachment for SSH, resource is in the format of
    // `projects/{project}/regions/{region}/serviceAttachments/{service_attachment}`.
    string ssh_service_attachment = 4 [
      (google.api.field_behavior) = OUTPUT_ONLY,
      (google.api.resource_reference) = {
        type: "compute.googleapis.com/ServiceAttachment"
      }
    ];

    // Optional. Additional allowed projects for setting up PSC connections.
    // Instance host project is automatically allowed and does not need to be
    // included in this list.
    repeated string psc_allowed_projects = 6
        [(google.api.field_behavior) = OPTIONAL];
  }

  // WorkforceIdentityFederationConfig allows this instance to support users
  // from external identity providers.
  message WorkforceIdentityFederationConfig {
    // Optional. Immutable. Whether Workforce Identity Federation is enabled.
    bool enabled = 1 [
      (google.api.field_behavior) = IMMUTABLE,
      (google.api.field_behavior) = OPTIONAL
    ];
  }

  // Optional. A unique identifier for an instance. The name should be of the
  // format:
  // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`
  //
  // `project_number`: Maps to a unique int64 id assigned to each project.
  //
  // `location_id`: Refers to the region where the instance will be deployed.
  // Since Secure Source Manager is a regional service, it must be one of the
  // valid GCP regions.
  //
  // `instance_id`: User provided name for the instance, must be unique for a
  // project_number and location_id combination.
  string name = 1 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Create timestamp.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Update timestamp.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Labels as key value pairs.
  map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Private settings for private instance.
  PrivateConfig private_config = 13 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Current state of the instance.
  State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. An optional field providing information about the current
  // instance state.
  StateNote state_note = 10 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Immutable. Customer-managed encryption key name, in the format
  // projects/*/locations/*/keyRings/*/cryptoKeys/*.
  string kms_key = 11 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "cloudkms.googleapis.com/CryptoKey"
    }
  ];

  // Output only. A list of hostnames for this instance.
  HostConfig host_config = 9 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Configuration for Workforce Identity Federation to support
  // third party identity provider. If unset, defaults to the Google OIDC IdP.
  WorkforceIdentityFederationConfig workforce_identity_federation_config = 14
      [(google.api.field_behavior) = OPTIONAL];
}

// Metadata of a Secure Source Manager repository.
message Repository {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/Repository"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}"
  };

  // URIs for the repository.
  message URIs {
    // Output only. HTML is the URI for user to view the repository in a
    // browser.
    string html = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. git_https is the git HTTPS URI for git operations.
    string git_https = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. API is the URI for API access.
    string api = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // Repository initialization configuration.
  message InitialConfig {
    // Default branch name of the repository.
    string default_branch = 1;

    // List of gitignore template names user can choose from.
    // Valid values: actionscript, ada, agda, android,
    // anjuta, ansible, appcelerator-titanium, app-engine, archives,
    // arch-linux-packages, atmel-studio, autotools, backup, bazaar, bazel,
    // bitrix, bricx-cc, c, cake-php, calabash, cf-wheels, chef-cookbook,
    // clojure, cloud9, c-make, code-igniter, code-kit, code-sniffer,
    // common-lisp, composer, concrete5, coq, cordova, cpp, craft-cms, cuda,
    // cvs, d, dart, dart-editor, delphi, diff, dm, dreamweaver, dropbox,
    // drupal, drupal-7, eagle, eclipse, eiffel-studio, elisp, elixir, elm,
    // emacs, ensime, epi-server, erlang, esp-idf, espresso, exercism,
    // expression-engine, ext-js, fancy, finale, flex-builder, force-dot-com,
    // fortran, fuel-php, gcov, git-book, gnome-shell-extension, go, godot, gpg,
    // gradle, grails, gwt, haskell, hugo, iar-ewarm, idris, igor-pro, images,
    // infor-cms, java, jboss, jboss-4, jboss-6, jdeveloper, jekyll,
    // jenkins-home, jenv, jet-brains, jigsaw, joomla, julia, jupyter-notebooks,
    // kate, kdevelop4, kentico, ki-cad, kohana, kotlin, lab-view, laravel,
    // lazarus, leiningen, lemon-stand, libre-office, lilypond, linux, lithium,
    // logtalk, lua, lyx, mac-os, magento, magento-1, magento-2, matlab, maven,
    // mercurial, mercury, metals, meta-programming-system, meteor,
    // microsoft-office, model-sim, momentics, mono-develop, nanoc, net-beans,
    // nikola, nim, ninja, node, notepad-pp, nwjs, objective--c, ocaml, octave,
    // opa, open-cart, openssl, oracle-forms, otto, packer, patch, perl, perl6,
    // phalcon, phoenix, pimcore, play-framework, plone, prestashop, processing,
    // psoc-creator, puppet, pure-script, putty, python, qooxdoo, qt, r, racket,
    // rails, raku, red, redcar, redis, rhodes-rhomobile, ros, ruby, rust, sam,
    // sass, sbt, scala, scheme, scons, scrivener, sdcc, seam-gen, sketch-up,
    // slick-edit, smalltalk, snap, splunk, stata, stella, sublime-text,
    // sugar-crm, svn, swift, symfony, symphony-cms, synopsys-vcs, tags,
    // terraform, tex, text-mate, textpattern, think-php, tortoise-git,
    // turbo-gears-2, typo3, umbraco, unity, unreal-engine, vagrant, vim,
    // virtual-env, virtuoso, visual-studio, visual-studio-code, vue, vvvv, waf,
    // web-methods, windows, word-press, xcode, xilinx, xilinx-ise, xojo,
    // yeoman, yii, zend-framework, zephir.
    repeated string gitignores = 2;

    // License template name user can choose from.
    // Valid values: license-0bsd, license-389-exception, aal, abstyles,
    // adobe-2006, adobe-glyph, adsl, afl-1-1, afl-1-2, afl-2-0, afl-2-1,
    // afl-3-0, afmparse, agpl-1-0, agpl-1-0-only, agpl-1-0-or-later,
    // agpl-3-0-only, agpl-3-0-or-later, aladdin, amdplpa, aml, ampas, antlr-pd,
    // antlr-pd-fallback, apache-1-0, apache-1-1, apache-2-0, apafml, apl-1-0,
    // apsl-1-0, apsl-1-1, apsl-1-2, apsl-2-0, artistic-1-0, artistic-1-0-cl8,
    // artistic-1-0-perl, artistic-2-0, autoconf-exception-2-0,
    // autoconf-exception-3-0, bahyph, barr, beerware, bison-exception-2-2,
    // bittorrent-1-0, bittorrent-1-1, blessing, blueoak-1-0-0,
    // bootloader-exception, borceux, bsd-1-clause, bsd-2-clause,
    // bsd-2-clause-freebsd, bsd-2-clause-netbsd, bsd-2-clause-patent,
    // bsd-2-clause-views, bsd-3-clause, bsd-3-clause-attribution,
    // bsd-3-clause-clear, bsd-3-clause-lbnl, bsd-3-clause-modification,
    // bsd-3-clause-no-nuclear-license, bsd-3-clause-no-nuclear-license-2014,
    // bsd-3-clause-no-nuclear-warranty, bsd-3-clause-open-mpi, bsd-4-clause,
    // bsd-4-clause-shortened, bsd-4-clause-uc, bsd-protection, bsd-source-code,
    // bsl-1-0, busl-1-1, cal-1-0, cal-1-0-combined-work-exception, caldera,
    // catosl-1-1, cc0-1-0, cc-by-1-0, cc-by-2-0, cc-by-3-0, cc-by-3-0-at,
    // cc-by-3-0-us, cc-by-4-0, cc-by-nc-1-0, cc-by-nc-2-0, cc-by-nc-3-0,
    // cc-by-nc-4-0, cc-by-nc-nd-1-0, cc-by-nc-nd-2-0, cc-by-nc-nd-3-0,
    // cc-by-nc-nd-3-0-igo, cc-by-nc-nd-4-0, cc-by-nc-sa-1-0, cc-by-nc-sa-2-0,
    // cc-by-nc-sa-3-0, cc-by-nc-sa-4-0, cc-by-nd-1-0, cc-by-nd-2-0,
    // cc-by-nd-3-0, cc-by-nd-4-0, cc-by-sa-1-0, cc-by-sa-2-0, cc-by-sa-2-0-uk,
    // cc-by-sa-2-1-jp, cc-by-sa-3-0, cc-by-sa-3-0-at, cc-by-sa-4-0, cc-pddc,
    // cddl-1-0, cddl-1-1, cdla-permissive-1-0, cdla-sharing-1-0, cecill-1-0,
    // cecill-1-1, cecill-2-0, cecill-2-1, cecill-b, cecill-c, cern-ohl-1-1,
    // cern-ohl-1-2, cern-ohl-p-2-0, cern-ohl-s-2-0, cern-ohl-w-2-0, clartistic,
    // classpath-exception-2-0, clisp-exception-2-0, cnri-jython, cnri-python,
    // cnri-python-gpl-compatible, condor-1-1, copyleft-next-0-3-0,
    // copyleft-next-0-3-1, cpal-1-0, cpl-1-0, cpol-1-02, crossword,
    // crystal-stacker, cua-opl-1-0, cube, c-uda-1-0, curl, d-fsl-1-0, diffmark,
    // digirule-foss-exception, doc, dotseqn, drl-1-0, dsdp, dvipdfm, ecl-1-0,
    // ecl-2-0, ecos-exception-2-0, efl-1-0, efl-2-0, egenix, entessa, epics,
    // epl-1-0, epl-2-0, erlpl-1-1, etalab-2-0, eu-datagrid, eupl-1-0, eupl-1-1,
    // eupl-1-2, eurosym, fair, fawkes-runtime-exception, fltk-exception,
    // font-exception-2-0, frameworx-1-0, freebsd-doc, freeimage,
    // freertos-exception-2-0, fsfap, fsful, fsfullr, ftl, gcc-exception-2-0,
    // gcc-exception-3-1, gd, gfdl-1-1-invariants-only,
    // gfdl-1-1-invariants-or-later, gfdl-1-1-no-invariants-only,
    // gfdl-1-1-no-invariants-or-later, gfdl-1-1-only, gfdl-1-1-or-later,
    // gfdl-1-2-invariants-only, gfdl-1-2-invariants-or-later,
    // gfdl-1-2-no-invariants-only, gfdl-1-2-no-invariants-or-later,
    // gfdl-1-2-only, gfdl-1-2-or-later, gfdl-1-3-invariants-only,
    // gfdl-1-3-invariants-or-later, gfdl-1-3-no-invariants-only,
    // gfdl-1-3-no-invariants-or-later, gfdl-1-3-only, gfdl-1-3-or-later,
    // giftware, gl2ps, glide, glulxe, glwtpl, gnu-javamail-exception, gnuplot,
    // gpl-1-0-only, gpl-1-0-or-later, gpl-2-0-only, gpl-2-0-or-later,
    // gpl-3-0-linking-exception, gpl-3-0-linking-source-exception,
    // gpl-3-0-only, gpl-3-0-or-later, gpl-cc-1-0, gsoap-1-3b, haskell-report,
    // hippocratic-2-1, hpnd, hpnd-sell-variant, htmltidy,
    // i2p-gpl-java-exception, ibm-pibs, icu, ijg, image-magick, imatix, imlib2,
    // info-zip, intel, intel-acpi, interbase-1-0, ipa, ipl-1-0, isc,
    // jasper-2-0, jpnic, json, lal-1-2, lal-1-3, latex2e, leptonica,
    // lgpl-2-0-only, lgpl-2-0-or-later, lgpl-2-1-only, lgpl-2-1-or-later,
    // lgpl-3-0-linking-exception, lgpl-3-0-only, lgpl-3-0-or-later, lgpllr,
    // libpng, libpng-2-0, libselinux-1-0, libtiff, libtool-exception,
    // liliq-p-1-1, liliq-r-1-1, liliq-rplus-1-1, linux-openib,
    // linux-syscall-note, llvm-exception, lpl-1-0, lpl-1-02, lppl-1-0,
    // lppl-1-1, lppl-1-2, lppl-1-3a, lppl-1-3c, lzma-exception, make-index,
    // mif-exception, miros, mit, mit-0, mit-advertising, mit-cmu, mit-enna,
    // mit-feh, mit-modern-variant, mitnfa, mit-open-group, motosoto, mpich2,
    // mpl-1-0, mpl-1-1, mpl-2-0, mpl-2-0-no-copyleft-exception, ms-pl, ms-rl,
    // mtll, mulanpsl-1-0, mulanpsl-2-0, multics, mup, naist-2003, nasa-1-3,
    // naumen, nbpl-1-0, ncgl-uk-2-0, ncsa, netcdf, net-snmp, newsletr, ngpl,
    // nist-pd, nist-pd-fallback, nlod-1-0, nlpl, nokia, nokia-qt-exception-1-1,
    // nosl, noweb, npl-1-0, npl-1-1, nposl-3-0, nrl, ntp, ntp-0,
    // ocaml-lgpl-linking-exception, occt-exception-1-0, occt-pl, oclc-2-0,
    // odbl-1-0, odc-by-1-0, ofl-1-0, ofl-1-0-no-rfn, ofl-1-0-rfn, ofl-1-1,
    // ofl-1-1-no-rfn, ofl-1-1-rfn, ogc-1-0, ogdl-taiwan-1-0, ogl-canada-2-0,
    // ogl-uk-1-0, ogl-uk-2-0, ogl-uk-3-0, ogtsl, oldap-1-1, oldap-1-2,
    // oldap-1-3, oldap-1-4, oldap-2-0, oldap-2-0-1, oldap-2-1, oldap-2-2,
    // oldap-2-2-1, oldap-2-2-2, oldap-2-3, oldap-2-4, oldap-2-7, oml,
    // openjdk-assembly-exception-1-0, openssl, openvpn-openssl-exception,
    // opl-1-0, oset-pl-2-1, osl-1-0, osl-1-1, osl-2-0, osl-2-1, osl-3-0,
    // o-uda-1-0, parity-6-0-0, parity-7-0-0, pddl-1-0, php-3-0, php-3-01,
    // plexus, polyform-noncommercial-1-0-0, polyform-small-business-1-0-0,
    // postgresql, psf-2-0, psfrag, ps-or-pdf-font-exception-20170817, psutils,
    // python-2-0, qhull, qpl-1-0, qt-gpl-exception-1-0, qt-lgpl-exception-1-1,
    // qwt-exception-1-0, rdisc, rhecos-1-1, rpl-1-1, rpsl-1-0, rsa-md, rscpl,
    // ruby, saxpath, sax-pd, scea, sendmail, sendmail-8-23, sgi-b-1-0,
    // sgi-b-1-1, sgi-b-2-0, shl-0-51, shl-2-0, shl-2-1, simpl-2-0, sissl,
    // sissl-1-2, sleepycat, smlnj, smppl, snia, spencer-86, spencer-94,
    // spencer-99, spl-1-0, ssh-openssh, ssh-short, sspl-1-0, sugarcrm-1-1-3,
    // swift-exception, swl, tapr-ohl-1-0, tcl, tcp-wrappers, tmate, torque-1-1,
    // tosl, tu-berlin-1-0, tu-berlin-2-0, u-boot-exception-2-0, ucl-1-0,
    // unicode-dfs-2015, unicode-dfs-2016, unicode-tou,
    // universal-foss-exception-1-0, unlicense, upl-1-0, vim, vostrom, vsl-1-0,
    // w3c, w3c-19980720, w3c-20150513, watcom-1-0, wsuipa, wtfpl,
    // wxwindows-exception-3-1, x11, xerox, xfree86-1-1, xinetd, xnet, xpp,
    // xskat, ypl-1-0, ypl-1-1, zed, zend-2-0, zimbra-1-3, zimbra-1-4, zlib,
    // zlib-acknowledgement, zpl-1-1, zpl-2-0, zpl-2-1.
    string license = 3;

    // README template name.
    // Valid template name(s) are: default.
    string readme = 4;
  }

  // Optional. A unique identifier for a repository. The name should be of the
  // format:
  // `projects/{project}/locations/{location_id}/repositories/{repository_id}`
  string name = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Description of the repository, which cannot exceed 500
  // characters.
  string description = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The name of the instance in which the repository is hosted,
  // formatted as
  // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`
  // When creating repository via securesourcemanager.googleapis.com, this field
  // is used as input. When creating repository via *.sourcemanager.dev, this
  // field is output only.
  string instance = 3 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Instance"
    }
  ];

  // Output only. Unique identifier of the repository.
  string uid = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Create timestamp.
  google.protobuf.Timestamp create_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Update timestamp.
  google.protobuf.Timestamp update_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. This checksum is computed by the server based on the value of
  // other fields, and may be sent on update and delete requests to ensure the
  // client has an up-to-date value before proceeding.
  string etag = 8 [(google.api.field_behavior) = OPTIONAL];

  // Output only. URIs for the repository.
  URIs uris = 9 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Input only. Initial configurations for the repository.
  InitialConfig initial_config = 10 [(google.api.field_behavior) = INPUT_ONLY];
}

// Metadata of a Secure Source Manager Hook.
message Hook {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/Hook"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}/hooks/{hook}"
  };

  enum HookEventType {
    // Unspecified.
    UNSPECIFIED = 0;

    // Push events are triggered when pushing to the repository.
    PUSH = 1;

    // Pull request events are triggered when a pull request is opened, closed,
    // reopened, or edited.
    PULL_REQUEST = 2;
  }

  message PushOption {
    // Optional. Trigger hook for matching branches only.
    // Specified as glob pattern. If empty or *, events for all branches are
    // reported. Examples: main, {main,release*}.
    // See https://pkg.go.dev/github.com/gobwas/glob documentation.
    string branch_filter = 1 [(google.api.field_behavior) = OPTIONAL];
  }

  // Identifier. A unique identifier for a Hook. The name should be of the
  // format:
  // `projects/{project}/locations/{location_id}/repositories/{repository_id}/hooks/{hook_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. The target URI to which the payloads will be delivered.
  string target_uri = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. Determines if the hook disabled or not.
  // Set to true to stop sending traffic.
  bool disabled = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The events that trigger hook on.
  repeated HookEventType events = 4 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Create timestamp.
  google.protobuf.Timestamp create_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Update timestamp.
  google.protobuf.Timestamp update_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Unique identifier of the hook.
  string uid = 7 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The trigger option for push events.
  PushOption push_option = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The sensitive query string to be appended to the target URI.
  string sensitive_query_string = 10 [(google.api.field_behavior) = OPTIONAL];
}

// Metadata of a BranchRule. BranchRule is the protection rule to enforce
// pre-defined rules on designated branches within a repository.
message BranchRule {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/BranchRule"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}"
  };

  // Check is a type for status check.
  message Check {
    // Required. The context of the check.
    string context = 1 [(google.api.field_behavior) = REQUIRED];
  }

  // Optional. A unique identifier for a BranchRule. The name should be of the
  // format:
  // `projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}`
  string name = 1 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Unique identifier of the repository.
  string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Create timestamp.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Update timestamp.
  google.protobuf.Timestamp update_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. User annotations. These attributes can only be set and used by
  // the user. See https://google.aip.dev/128#annotations for more details such
  // as format and size limitations.
  map<string, string> annotations = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. This checksum is computed by the server based on the value of
  // other fields, and may be sent on update and delete requests to ensure the
  // client has an up-to-date value before proceeding.
  string etag = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The pattern of the branch that can match to this BranchRule.
  // Specified as regex.
  // .* for all branches. Examples: main, (main|release.*).
  // Current MVP phase only support `.*` for wildcard.
  string include_pattern = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Determines if the branch rule is disabled or not.
  bool disabled = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Determines if the branch rule requires a pull request or not.
  bool require_pull_request = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The minimum number of reviews required for the branch rule to be
  // matched.
  int32 minimum_reviews_count = 10 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The minimum number of approvals required for the branch rule to
  // be matched.
  int32 minimum_approvals_count = 11 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Determines if require comments resolved before merging to the
  // branch.
  bool require_comments_resolved = 12 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Determines if allow stale reviews or approvals before merging to
  // the branch.
  bool allow_stale_reviews = 15 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Determines if require linear history before merging to the
  // branch.
  bool require_linear_history = 13 [(google.api.field_behavior) = OPTIONAL];

  // Optional. List of required status checks before merging to the branch.
  repeated Check required_status_checks = 14
      [(google.api.field_behavior) = OPTIONAL];
}

// Metadata of a PullRequest. PullRequest is the request
// from a user to merge a branch (head) into another branch (base).
message PullRequest {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/PullRequest"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}/pullRequests/{pull_request}"
  };

  // Branch represents a branch involved in a pull request.
  message Branch {
    // Required. Name of the branch.
    string ref = 1 [(google.api.field_behavior) = REQUIRED];

    // Output only. The commit at the tip of the branch.
    string sha = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // State of the pull request.
  enum State {
    // Unspecified.
    STATE_UNSPECIFIED = 0;

    // An open pull request.
    OPEN = 1;

    // A closed pull request.
    CLOSED = 2;

    // A merged pull request.
    MERGED = 3;
  }

  // Output only. A unique identifier for a PullRequest. The number appended at
  // the end is generated by the server. Format:
  // `projects/{project}/locations/{location}/repositories/{repository}/pullRequests/{pull_request_id}`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. The pull request title.
  string title = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. The pull request body. Provides a detailed description of the
  // changes.
  string body = 3 [(google.api.field_behavior) = OPTIONAL];

  // Required. The branch to merge changes in.
  Branch base = 4 [(google.api.field_behavior) = REQUIRED];

  // Immutable. The branch containing the changes to be merged.
  Branch head = 5 [(google.api.field_behavior) = IMMUTABLE];

  // Output only. State of the pull request (open, closed or merged).
  State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Creation timestamp.
  google.protobuf.Timestamp create_time = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last updated timestamp.
  google.protobuf.Timestamp update_time = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Close timestamp (if closed or merged). Cleared when pull
  // request is re-opened.
  google.protobuf.Timestamp close_time = 9
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Metadata of a FileDiff. FileDiff represents a single file diff in a pull
// request.
message FileDiff {
  // Action taken on the file.
  enum Action {
    // Unspecified.
    ACTION_UNSPECIFIED = 0;

    // The file was added.
    ADDED = 1;

    // The file was modified.
    MODIFIED = 2;

    // The file was deleted.
    DELETED = 3;
  }

  // Output only. The name of the file.
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The action taken on the file (eg. added, modified, deleted).
  Action action = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The commit pointing to the file changes.
  string sha = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The git patch containing the file changes.
  string patch = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Metadata of an Issue.
message Issue {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/Issue"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}/issues/{issue}"
  };

  // Possible states of an issue.
  enum State {
    // Unspecified.
    STATE_UNSPECIFIED = 0;

    // An open issue.
    OPEN = 1;

    // A closed issue.
    CLOSED = 2;
  }

  // Identifier. Unique identifier for an issue. The issue id is generated by
  // the server. Format:
  // `projects/{project}/locations/{location}/repositories/{repository}/issues/{issue_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. Issue title.
  string title = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. Issue body. Provides a detailed description of the issue.
  string body = 3 [(google.api.field_behavior) = OPTIONAL];

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

  // Output only. Creation timestamp.
  google.protobuf.Timestamp create_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last updated timestamp.
  google.protobuf.Timestamp update_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Close timestamp (if closed). Cleared when is re-opened.
  google.protobuf.Timestamp close_time = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. This checksum is computed by the server based on the value of
  // other fields, and may be sent on update and delete requests to ensure the
  // client has an up-to-date value before proceeding.
  string etag = 8 [(google.api.field_behavior) = OPTIONAL];
}

// IssueComment represents a comment on an issue.
message IssueComment {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/IssueComment"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}/issues/{issue}/issueComments/{comment}"
  };

  // Identifier. Unique identifier for an issue comment. The comment id is
  // generated by the server. Format:
  // `projects/{project}/locations/{location}/repositories/{repository}/issues/{issue}/issueComments/{comment_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. The comment body.
  string body = 2 [(google.api.field_behavior) = REQUIRED];

  // Output only. Creation timestamp.
  google.protobuf.Timestamp create_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last updated timestamp.
  google.protobuf.Timestamp update_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// PullRequestComment represents a comment on a pull request.
message PullRequestComment {
  option (google.api.resource) = {
    type: "securesourcemanager.googleapis.com/PullRequestComment"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}/pullRequests/{pull_request}/pullRequestComments/{comment}"
  };

  // The review summary comment.
  message Review {
    // The review action type.
    enum ActionType {
      // Unspecified.
      ACTION_TYPE_UNSPECIFIED = 0;

      // A general review comment.
      COMMENT = 1;

      // Change required from this review.
      CHANGE_REQUESTED = 2;

      // Change approved from this review.
      APPROVED = 3;
    }

    // Required. The review action type.
    ActionType action_type = 1 [(google.api.field_behavior) = REQUIRED];

    // Optional. The comment body.
    string body = 2 [(google.api.field_behavior) = OPTIONAL];

    // Output only. The effective commit sha this review is pointing to.
    string effective_commit_sha = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // The general pull request comment.
  message Comment {
    // Required. The comment body.
    string body = 1 [(google.api.field_behavior) = REQUIRED];
  }

  // The comment on a code line.
  message Code {
    // Required. The comment body.
    string body = 1 [(google.api.field_behavior) = REQUIRED];

    // Optional. Input only. The PullRequestComment resource name that this
    // comment is replying to.
    string reply = 2 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = INPUT_ONLY
    ];

    // Optional. The position of the comment.
    Position position = 3 [(google.api.field_behavior) = OPTIONAL];

    // Output only. The root comment of the conversation, derived from the reply
    // field.
    string effective_root_comment = 4
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. Boolean indicator if the comment is resolved.
    bool resolved = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. The effective commit sha this code comment is pointing to.
    string effective_commit_sha = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // The position of the code comment.
  message Position {
    // Required. The path of the file.
    string path = 1 [(google.api.field_behavior) = REQUIRED];

    // Required. The line number of the comment. Positive value means it's on
    // the new side of the diff, negative value means it's on the old side.
    int64 line = 2 [(google.api.field_behavior) = REQUIRED];
  }

  // Identifier. Unique identifier for the pull request comment. The comment id
  // is generated by the server. Format:
  // `projects/{project}/locations/{location}/repositories/{repository}/pullRequests/{pull_request}/pullRequestComments/{comment_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. Creation timestamp.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last updated timestamp.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // The comment detail. A comment can be a review, a general comment, or a
  // code comment.
  oneof comment_detail {
    // Optional. The review summary comment.
    Review review = 4 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The general pull request comment.
    Comment comment = 5 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The comment on a code line.
    Code code = 6 [(google.api.field_behavior) = OPTIONAL];
  }
}

// ListInstancesRequest is the request to list instances.
message ListInstancesRequest {
  // Required. Parent value for ListInstancesRequest.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/Instance"
    }
  ];

  // Requested page size. Server may return fewer items than requested.
  // If unspecified, server will pick an appropriate default.
  int32 page_size = 2;

  // A token identifying a page of results the server should return.
  string page_token = 3;

  // Filter for filtering results.
  string filter = 4;

  // Hint for how to order the results.
  string order_by = 5;
}

message ListInstancesResponse {
  // The list of instances.
  repeated Instance instances = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable = 3;
}

// GetInstanceRequest is the request for getting an instance.
message GetInstanceRequest {
  // Required. Name of the resource.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Instance"
    }
  ];
}

// CreateInstanceRequest is the request for creating an instance.
message CreateInstanceRequest {
  // Required. Value for parent.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/Instance"
    }
  ];

  // Required. ID of the instance to be created.
  string instance_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The resource being created.
  Instance instance = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and
  // the request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
}

// DeleteInstanceRequest is the request for deleting an instance.
message DeleteInstanceRequest {
  // Required. Name of the resource.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Instance"
    }
  ];

  // Optional. An optional request ID to identify requests. Specify a unique
  // request ID so that if you must retry your request, the server will know to
  // ignore the request if it has already been completed. The server will
  // guarantee that for at least 60 minutes after the first request.
  //
  // For example, consider a situation where you make an initial request and
  // the request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 2 [(google.api.field_behavior) = OPTIONAL];
}

// 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.
  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. Operations that have successfully been cancelled
  // have [Operation.error][google.longrunning.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];
}

// ListRepositoriesRequest is request to list repositories.
message ListRepositoriesRequest {
  // Required. Parent value for ListRepositoriesRequest.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // A token identifying a page of results the server should return.
  string page_token = 3;

  // Optional. Filter results.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The name of the instance in which the repository is hosted,
  // formatted as
  // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`.
  // When listing repositories via securesourcemanager.googleapis.com, this
  // field is required. When listing repositories via *.sourcemanager.dev, this
  // field is ignored.
  string instance = 5 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Instance"
    }
  ];
}

message ListRepositoriesResponse {
  // The list of repositories.
  repeated Repository repositories = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// GetRepositoryRequest is the request for getting a repository.
message GetRepositoryRequest {
  // Required. Name of the repository to retrieve.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];
}

// CreateRepositoryRequest is the request for creating a repository.
message CreateRepositoryRequest {
  // Required. The project in which to create the repository. Values are of the
  // form `projects/{project_number}/locations/{location_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Required. The resource being created.
  Repository repository = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The ID to use for the repository, which will become the final
  // component of the repository's resource name. This value should be 4-63
  // characters, and valid characters are /[a-z][0-9]-/.
  string repository_id = 3 [(google.api.field_behavior) = REQUIRED];
}

// UpdateRepositoryRequest is the request to update a repository.
message UpdateRepositoryRequest {
  // Optional. Field mask is used to specify the fields to be overwritten in the
  // repository resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask. If the
  // user does not provide a mask then all fields will be overwritten.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Required. The repository being updated.
  Repository repository = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. False by default. If set to true, the request is validated and
  // the user is provided with an expected result, but no actual change is made.
  bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
}

// DeleteRepositoryRequest is the request to delete a repository.
message DeleteRepositoryRequest {
  // Required. Name of the repository to delete.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Optional. If set to true, and the repository is not found, the request will
  // succeed but no action will be taken on the server.
  bool allow_missing = 2 [(google.api.field_behavior) = OPTIONAL];
}

// ListHooksRequest is request to list hooks.
message ListHooksRequest {
  // Required. Parent value for ListHooksRequest.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/Hook"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// ListHooksResponse is response to list hooks.
message ListHooksResponse {
  // The list of hooks.
  repeated Hook hooks = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// GetHookRequest is the request for getting a hook.
message GetHookRequest {
  // Required. Name of the hook to retrieve.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/hooks/{hook_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Hook"
    }
  ];
}

// CreateHookRequest is the request for creating a hook.
message CreateHookRequest {
  // Required. The repository in which to create the hook. Values are of the
  // form
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Required. The resource being created.
  Hook hook = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The ID to use for the hook, which will become the final component
  // of the hook's resource name. This value restricts to lower-case letters,
  // numbers, and hyphen, with the first character a letter, the last a letter
  // or a number, and a 63 character maximum.
  string hook_id = 3 [(google.api.field_behavior) = REQUIRED];
}

// UpdateHookRequest is the request to update a hook.
message UpdateHookRequest {
  // Required. Field mask is used to specify the fields to be overwritten in the
  // hook resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask.
  // The special value "*" means full replacement.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = REQUIRED];

  // Required. The hook being updated.
  Hook hook = 2 [(google.api.field_behavior) = REQUIRED];
}

// DeleteHookRequest is the request to delete a hook.
message DeleteHookRequest {
  // Required. Name of the hook to delete.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/hooks/{hook_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Hook"
    }
  ];
}

// GetBranchRuleRequest is the request for getting a branch rule.
message GetBranchRuleRequest {
  // Required. Name of the repository to retrieve.
  // The format is
  // `projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/BranchRule"
    }
  ];
}

// CreateBranchRuleRequest is the request to create a branch rule.
message CreateBranchRuleRequest {
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/BranchRule"
    }
  ];

  BranchRule branch_rule = 2 [(google.api.field_behavior) = REQUIRED];

  string branch_rule_id = 3 [(google.api.field_behavior) = REQUIRED];
}

// ListBranchRulesRequest is the request to list branch rules.
message ListBranchRulesRequest {
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/BranchRule"
    }
  ];

  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// DeleteBranchRuleRequest is the request to delete a branch rule.
message DeleteBranchRuleRequest {
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/BranchRule"
    }
  ];

  // Optional. If set to true, and the branch rule is not found, the request
  // will succeed but no action will be taken on the server.
  bool allow_missing = 2 [(google.api.field_behavior) = OPTIONAL];
}

// UpdateBranchRuleRequest is the request to update a branchRule.
message UpdateBranchRuleRequest {
  BranchRule branch_rule = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. If set, validate the request and preview the review, but do not
  // actually post it.  (https://google.aip.dev/163, for declarative friendly)
  bool validate_only = 2 [(google.api.field_behavior) = OPTIONAL];

  // Required. Field mask is used to specify the fields to be overwritten in the
  // branchRule resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask.
  // The special value "*" means full replacement.
  google.protobuf.FieldMask update_mask = 3
      [(google.api.field_behavior) = REQUIRED];
}

// ListBranchRulesResponse is the response to listing branchRules.
message ListBranchRulesResponse {
  // The list of branch rules.
  repeated BranchRule branch_rules = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// CreatePullRequestRequest is the request to create a pull request.
message CreatePullRequestRequest {
  // Required. The repository that the pull request is created from. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Required. The pull request to create.
  PullRequest pull_request = 2 [(google.api.field_behavior) = REQUIRED];
}

// GetPullRequestRequest is the request to get a pull request.
message GetPullRequestRequest {
  // Required. Name of the pull request to retrieve.
  // The format is
  // `projects/{project}/locations/{location}/repositories/{repository}/pullRequests/{pull_request}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequest"
    }
  ];
}

// ListPullRequestsRequest is the request to list pull requests.
message ListPullRequestsRequest {
  // Required. The repository in which to list pull requests. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// ListPullRequestsResponse is the response to list pull requests.
message ListPullRequestsResponse {
  // The list of pull requests.
  repeated PullRequest pull_requests = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// UpdatePullRequestRequest is the request to update a pull request.
message UpdatePullRequestRequest {
  // Required. The pull request to update.
  PullRequest pull_request = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. Field mask is used to specify the fields to be overwritten in the
  // pull request resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask.
  // The special value "*" means full replacement.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// MergePullRequestRequest is the request to merge a pull request.
message MergePullRequestRequest {
  // Required. The pull request to merge.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequest"
    }
  ];
}

// OpenPullRequestRequest is the request to open a pull request.
message OpenPullRequestRequest {
  // Required. The pull request to open.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequest"
    }
  ];
}

// ClosePullRequestRequest is the request to close a pull request.
message ClosePullRequestRequest {
  // Required. The pull request to close.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequest"
    }
  ];
}

// ListPullRequestFileDiffsRequest is the request to list pull request file
// diffs.
message ListPullRequestFileDiffsRequest {
  // Required. The pull request to list file diffs for.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequest"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// ListPullRequestFileDiffsResponse is the response containing file diffs
// returned from ListPullRequestFileDiffs.
message ListPullRequestFileDiffsResponse {
  // The list of pull request file diffs.
  repeated FileDiff file_diffs = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// The request to create an issue.
message CreateIssueRequest {
  // Required. The repository in which to create the issue. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

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

// The request to get an issue.
message GetIssueRequest {
  // Required. Name of the issue to retrieve.
  // The format is
  // `projects/{project}/locations/{location}/repositories/{repository}/issues/{issue_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Issue"
    }
  ];
}

// The request to list issues.
message ListIssuesRequest {
  // Required. The repository in which to list issues. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/Issue"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Used to filter the resulting issues list.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
}

// The response to list issues.
message ListIssuesResponse {
  // The list of issues.
  repeated Issue issues = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// The request to update an issue.
message UpdateIssueRequest {
  // Required. The issue to update.
  Issue issue = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. Field mask is used to specify the fields to be overwritten in the
  // issue resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask.
  // The special value "*" means full replacement.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// The request to delete an issue.
message DeleteIssueRequest {
  // Required. Name of the issue to delete.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/issues/{issue_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Issue"
    }
  ];

  // Optional. The current etag of the issue.
  // If the etag is provided and does not match the current etag of the issue,
  // deletion will be blocked and an ABORTED error will be returned.
  string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}

// The request to close an issue.
message CloseIssueRequest {
  // Required. Name of the issue to close.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/issues/{issue_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Issue"
    }
  ];

  // Optional. The current etag of the issue.
  // If the etag is provided and does not match the current etag of the issue,
  // closing will be blocked and an ABORTED error will be returned.
  string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}

// The request to open an issue.
message OpenIssueRequest {
  // Required. Name of the issue to open.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/issues/{issue_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Issue"
    }
  ];

  // Optional. The current etag of the issue.
  // If the etag is provided and does not match the current etag of the issue,
  // opening will be blocked and an ABORTED error will be returned.
  string etag = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Represents an entry within a tree structure (like a Git tree).
message TreeEntry {
  // Defines the type of object the TreeEntry represents.
  enum ObjectType {
    // Default value, indicating the object type is unspecified.
    OBJECT_TYPE_UNSPECIFIED = 0;

    // Represents a directory (folder).
    TREE = 1;

    // Represents a file (contains file data).
    BLOB = 2;

    // Represents a pointer to another repository (submodule).
    COMMIT = 3;
  }

  // Output only. The type of the object (TREE, BLOB, COMMIT).  Output-only.
  ObjectType type = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The SHA-1 hash of the object (unique identifier). Output-only.
  string sha = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The path of the file or directory within the tree (e.g.,
  // "src/main/java/MyClass.java"). Output-only.
  string path = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The file mode as a string (e.g., "100644"). Indicates file
  // type. Output-only.
  string mode = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The size of the object in bytes (only for blobs). Output-only.
  int64 size = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for fetching a tree structure from a repository.
message FetchTreeRequest {
  // Required. The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`.
  // Specifies the repository to fetch the tree from.
  string repository = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Optional. `ref` can be a SHA-1 hash, a branch name, or a tag. Specifies
  // which tree to fetch. If not specified, the default branch will be used.
  string ref = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. If true, include all subfolders and their files in the response.
  // If false, only the immediate children are returned.
  bool recursive = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Requested page size.  Server may return fewer items than
  // requested. If unspecified, at most 10,000 items will be returned.
  int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message containing a list of TreeEntry objects.
message FetchTreeResponse {
  // The list of TreeEntry objects.
  repeated TreeEntry tree_entries = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// Request message for fetching a blob (file content) from a repository.
message FetchBlobRequest {
  // Required. The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}`.
  // Specifies the repository containing the blob.
  string repository = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Repository"
    }
  ];

  // Required. The SHA-1 hash of the blob to retrieve.
  string sha = 2 [(google.api.field_behavior) = REQUIRED];
}

// Response message containing the content of a blob.
message FetchBlobResponse {
  // The SHA-1 hash of the blob.
  string sha = 1;

  // The content of the blob, encoded as base64.
  string content = 2;
}

// The request to list pull request comments.
message ListPullRequestCommentsRequest {
  // Required. The pull request in which to list pull request comments. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];

  // Optional. Requested page size. If unspecified, at most 100 pull request
  // comments will be returned. The maximum value is 100; values above 100 will
  // be coerced to 100.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// The response to list pull request comments.
message ListPullRequestCommentsResponse {
  // The list of pull request comments.
  repeated PullRequestComment pull_request_comments = 1;

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

// The request to create a pull request comment.
message CreatePullRequestCommentRequest {
  // Required. The pull request in which to create the pull request comment.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];

  // Required. The pull request comment to create.
  PullRequestComment pull_request_comment = 2
      [(google.api.field_behavior) = REQUIRED];
}

// The request to batch create pull request comments.
message BatchCreatePullRequestCommentsRequest {
  // Required. The pull request in which to create the pull request comments.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];

  // Required. The request message specifying the resources to create. There
  // should be exactly one CreatePullRequestCommentRequest with CommentDetail
  // being REVIEW in the list, and no more than 100
  // CreatePullRequestCommentRequests with CommentDetail being CODE in the list
  repeated CreatePullRequestCommentRequest requests = 2
      [(google.api.field_behavior) = REQUIRED];
}

// The response to batch create pull request comments.
message BatchCreatePullRequestCommentsResponse {
  // The list of pull request comments created.
  repeated PullRequestComment pull_request_comments = 1;
}

// The request to update a pull request comment.
message UpdatePullRequestCommentRequest {
  // Required. The pull request comment to update.
  PullRequestComment pull_request_comment = 1
      [(google.api.field_behavior) = REQUIRED];

  // Optional. Field mask is used to specify the fields to be overwritten in the
  // pull request comment resource by the update. Updatable fields are
  // `body`.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// The request to delete a pull request comment. A Review PullRequestComment
// cannot be deleted.
message DeletePullRequestCommentRequest {
  // Required. Name of the pull request comment to delete.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}/pullRequestComments/{comment_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];
}

// The request to get a pull request comment.
message GetPullRequestCommentRequest {
  // Required. Name of the pull request comment to retrieve.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}/pullRequestComments/{comment_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];
}

// The request to resolve multiple pull request comments.
message ResolvePullRequestCommentsRequest {
  // Required. The pull request in which to resolve the pull request comments.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];

  // Required. The names of the pull request comments to resolve. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}/pullRequestComments/{comment_id}`
  // Only comments from the same threads are allowed in the same request.
  repeated string names = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];

  // Optional. If set, at least one comment in a thread is required, rest of the
  // comments in the same thread will be automatically updated to resolved. If
  // unset, all comments in the same thread need be present.
  bool auto_fill = 3 [(google.api.field_behavior) = OPTIONAL];
}

// The response to resolve multiple pull request comments.
message ResolvePullRequestCommentsResponse {
  // The list of pull request comments resolved.
  repeated PullRequestComment pull_request_comments = 1;
}

// The request to unresolve multiple pull request comments.
message UnresolvePullRequestCommentsRequest {
  // Required. The pull request in which to resolve the pull request comments.
  // Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];

  // Required. The names of the pull request comments to unresolve. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/pullRequests/{pull_request_id}/pullRequestComments/{comment_id}`
  // Only comments from the same threads are allowed in the same request.
  repeated string names = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/PullRequestComment"
    }
  ];

  // Optional. If set, at least one comment in a thread is required, rest of the
  // comments in the same thread will be automatically updated to unresolved. If
  // unset, all comments in the same thread need be present.
  bool auto_fill = 3 [(google.api.field_behavior) = OPTIONAL];
}

// The response to unresolve multiple pull request comments.
message UnresolvePullRequestCommentsResponse {
  // The list of pull request comments unresolved.
  repeated PullRequestComment pull_request_comments = 1;
}

// The request to create an issue comment.
message CreateIssueCommentRequest {
  // Required. The issue in which to create the issue comment. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/issues/{issue_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/Issue"
    }
  ];

  // Required. The issue comment to create.
  IssueComment issue_comment = 2 [(google.api.field_behavior) = REQUIRED];
}

// The request to get an issue comment.
message GetIssueCommentRequest {
  // Required. Name of the issue comment to retrieve.
  // The format is
  // `projects/{project}/locations/{location}/repositories/{repository}/issues/{issue_id}/issueComments/{comment_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/IssueComment"
    }
  ];
}

// The request to list issue comments.
message ListIssueCommentsRequest {
  // Required. The issue in which to list the comments. Format:
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/issues/{issue_id}`
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "securesourcemanager.googleapis.com/IssueComment"
    }
  ];

  // Optional. Requested page size. Server may return fewer items than
  // requested. If unspecified, server will pick an appropriate default.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A token identifying a page of results the server should return.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
}

// The response to list issue comments.
message ListIssueCommentsResponse {
  // The list of issue comments.
  repeated IssueComment issue_comments = 1;

  // A token identifying a page of results the server should return.
  string next_page_token = 2;
}

// The request to update an issue comment.
message UpdateIssueCommentRequest {
  // Required. The issue comment to update.
  IssueComment issue_comment = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. Field mask is used to specify the fields to be overwritten in the
  // issue comment resource by the update.
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask.
  // The special value "*" means full replacement.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// The request to delete an issue comment.
message DeleteIssueCommentRequest {
  // Required. Name of the issue comment to delete.
  // The format is
  // `projects/{project_number}/locations/{location_id}/repositories/{repository_id}/issues/{issue_id}/issueComments/{comment_id}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "securesourcemanager.googleapis.com/IssueComment"
    }
  ];
}
