// Copyright 2026 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.ads.googleads.v22.services;

import "google/ads/googleads/v22/enums/multi_party_auth_review_status.proto";
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/rpc/status.proto";

option csharp_namespace = "Google.Ads.GoogleAds.V22.Services";
option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v22/services;services";
option java_multiple_files = true;
option java_outer_classname = "MultiPartyAuthReviewServiceProto";
option java_package = "com.google.ads.googleads.v22.services";
option objc_class_prefix = "GAA";
option php_namespace = "Google\\Ads\\GoogleAds\\V22\\Services";
option ruby_package = "Google::Ads::GoogleAds::V22::Services";

// Service to manage Multi-Party Authorization requests.
service MultiPartyAuthReviewService {
  option (google.api.default_host) = "googleads.googleapis.com";
  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/adwords";

  // Resolves the status of a Multi-Party Authorization review.
  //
  // List of thrown errors:
  //   [AccessInvitationError]()
  //   [AuthenticationError]()
  //   [AuthorizationError]()
  //   [CustomerUserAccessError]()
  //   [FieldError]()
  //   [HeaderError]()
  //   [InternalError]()
  //   [MultiPartyAuthReviewError]()
  //   [MutateError]()
  //   [QuotaError]()
  //   [RangeError]()
  //   [RequestError]()
  rpc ResolveMultiPartyAuthReview(ResolveMultiPartyAuthReviewRequest)
      returns (ResolveMultiPartyAuthReviewResponse) {
    option (google.api.http) = {
      post: "/v22/customers/{customer_id=*}/multiPartyAuthReview:resolve"
      body: "*"
    };
    option (google.api.method_signature) = "customer_id,operations";
  }
}

// Request message for
// [MultiPartyAuthReviewService.ResolveMultiPartyAuthReview][google.ads.googleads.v22.services.MultiPartyAuthReviewService.ResolveMultiPartyAuthReview].
message ResolveMultiPartyAuthReviewRequest {
  // Required. The ID of the customer.
  string customer_id = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The operations to perform. Currently only one operation is
  // supported.
  repeated ResolveMultiPartyAuthReviewOperation operations = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Response message for
// [MultiPartyAuthReviewService.ResolveMultiPartyAuthReview][google.ads.googleads.v22.services.MultiPartyAuthReviewService.ResolveMultiPartyAuthReview].
message ResolveMultiPartyAuthReviewResponse {
  // The results of the operations.
  repeated ResolveMultiPartyAuthReviewResultOrError result_or_error = 1;
}

// Operation to resolve a Multi-Party Authorization review.
message ResolveMultiPartyAuthReviewOperation {
  // Required. The resource name of the Multi-Party Authorization review.
  string multi_party_auth_review = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "googleads.googleapis.com/MultiPartyAuthReview"
    }
  ];

  // Required. The status to which the Multi-Party Authorization review should
  // be resolved. Valid values for requests are limited to: APPROVED, REJECTED,
  // REVOKED.
  google.ads.googleads.v22.enums.MultiPartyAuthReviewStatusEnum
      .MultiPartyAuthReviewStatus new_status = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Result of the ResolveMultiPartyAuthReview action.
message ResolveMultiPartyAuthReviewResultOrError {
  // Result or error of the operation.
  oneof result_or_error {
    // The result of the operation in case of success.
    ResolveMultiPartyAuthReviewResult result = 1;

    // Failure status when the request could not be processed.
    google.rpc.Status partial_failure_error = 2;
  }
}

// Result of the ResolveMultiPartyAuthReview action.
message ResolveMultiPartyAuthReviewResult {
  // Output only. The resource name of the Multi-Party Auth review itself.
  string multi_party_auth_review = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "googleads.googleapis.com/MultiPartyAuthReview"
    }
  ];

  // If the action taken was APPROVED and the review resulted in the creation of
  // an entity, the resource name of the created entity will be returned. If an
  // existing entity was mutated, the existing entity's resource name is
  // returned. If the action taken was REJECTED or REVOKED, no resource name is
  // returned.
  oneof resolved_resource {
    // Output only. The resource name of the CustomerUserAccessInvitation
    // resource.
    string customer_user_access_invitation = 2
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. The resource name of the CustomerUserAccess resource.
    string customer_user_access = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  }
}
