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

import "google/ads/datamanager/v1/destination.proto";
import "google/ads/datamanager/v1/match_rate.proto";
import "google/ads/datamanager/v1/processing_errors.proto";

option csharp_namespace = "Google.Ads.DataManager.V1";
option go_package = "cloud.google.com/go/datamanager/apiv1/datamanagerpb;datamanagerpb";
option java_multiple_files = true;
option java_outer_classname = "RequestStatusPerDestinationProto";
option java_package = "com.google.ads.datamanager.v1";
option php_namespace = "Google\\Ads\\DataManager\\V1";
option ruby_package = "Google::Ads::DataManager::V1";

// A request status per destination.
message RequestStatusPerDestination {
  // The request status.
  enum RequestStatus {
    // The request status is unknown.
    REQUEST_STATUS_UNKNOWN = 0;

    // Processing succeeded for all records without any errors. However, there
    // may be warnings in the
    // [`warning_info`][google.ads.datamanager.v1.RequestStatusPerDestination.warning_info]
    // field.
    SUCCESS = 1;

    // The request is processing.
    PROCESSING = 2;

    // Processing failed for all records. Check the
    // [`error_info`][google.ads.datamanager.v1.RequestStatusPerDestination.error_info]
    // field for error details, and check the
    // [`warning_info`][google.ads.datamanager.v1.RequestStatusPerDestination.warning_info]
    // field for warning details.
    FAILED = 3;

    // Processing completed successfully without errors for some records, but
    // failed with errors for other records. Check the
    // [`error_info`][google.ads.datamanager.v1.RequestStatusPerDestination.error_info]
    // field for error details, and check the
    // [`warning_info`][google.ads.datamanager.v1.RequestStatusPerDestination.warning_info]
    // field for warning details.
    PARTIAL_SUCCESS = 4;
  }

  // The status of the ingest audience members request.
  message IngestAudienceMembersStatus {
    // The status of the audience members ingestion to the destination.
    oneof status {
      // The status of the user data ingestion to the destination.
      IngestUserDataStatus user_data_ingestion_status = 1;

      // The status of the mobile data ingestion to the destination.
      IngestMobileDataStatus mobile_data_ingestion_status = 2;

      // The status of the pair data ingestion to the destination.
      IngestPairDataStatus pair_data_ingestion_status = 3;

      // The status of the user id data ingestion to the destination.
      IngestUserIdDataStatus user_id_data_ingestion_status = 4;

      // The status of the ppid data ingestion to the destination.
      IngestPpidDataStatus ppid_data_ingestion_status = 5;

      // The status of the composite data ingestion to the destination.
      IngestCompositeDataStatus composite_data_ingestion_status = 6;
    }
  }

  // The status of the remove audience members request.
  message RemoveAudienceMembersStatus {
    // The status of the audience members removal from the destination.
    oneof status {
      // The status of the user data removal from the destination.
      RemoveUserDataStatus user_data_removal_status = 1;

      // The status of the mobile data removal from the destination.
      RemoveMobileDataStatus mobile_data_removal_status = 2;

      // The status of the pair data removal from the destination.
      RemovePairDataStatus pair_data_removal_status = 3;

      // The status of the user id data removal from the destination.
      RemoveUserIdDataStatus user_id_data_removal_status = 4;

      // The status of the ppid data removal from the destination.
      RemovePpidDataStatus ppid_data_removal_status = 5;

      // The status of the composite data removal from the destination.
      RemoveCompositeDataStatus composite_data_removal_status = 6;
    }
  }

  // The status of the events ingestion to the destination.
  message IngestEventsStatus {
    // The total count of events sent in the upload request. Includes all
    // events in the request, regardless of whether they were successfully
    // ingested or not.
    int64 record_count = 1;
  }

  // The status of the user data ingestion to the destination containing stats
  // related to the ingestion.
  message IngestUserDataStatus {
    // The total count of audience members sent in the upload request for the
    // destination. Includes all audience members in the request, regardless of
    // whether they were successfully ingested or not.
    int64 record_count = 1;

    // The total count of user identifiers sent in the upload request for the
    // destination. Includes all user identifiers in the request, regardless of
    // whether they were successfully ingested or not.
    int64 user_identifier_count = 2;

    // The match rate range of the upload.
    MatchRateRange upload_match_rate_range = 3;
  }

  // The status of the user data removal from the destination.
  message RemoveUserDataStatus {
    // The total count of audience members sent in the removal request. Includes
    // all audience members in the request, regardless of whether they were
    // successfully removed or not.
    int64 record_count = 1;

    // The total count of user identifiers sent in the removal request. Includes
    // all user identifiers in the request, regardless of whether they were
    // successfully removed or not.
    int64 user_identifier_count = 2;
  }

  // The status of the mobile data ingestion to the destination containing stats
  // related to the ingestion.
  message IngestMobileDataStatus {
    // The total count of audience members sent in the upload request for the
    // destination. Includes all audience members in the request, regardless of
    // whether they were successfully ingested or not.
    int64 record_count = 1;

    // The total count of mobile ids sent in the upload request for the
    // destination. Includes all mobile ids in the request, regardless of
    // whether they were successfully ingested or not.
    int64 mobile_id_count = 2;
  }

  // The status of the mobile data removal from the destination.
  message RemoveMobileDataStatus {
    // The total count of audience members sent in the removal request. Includes
    // all audience members in the request, regardless of whether they were
    // successfully removed or not.
    int64 record_count = 1;

    // The total count of mobile Ids sent in the removal request. Includes all
    // mobile ids in the request, regardless of whether they were successfully
    // removed or not.
    int64 mobile_id_count = 2;
  }

  // The status of the pair data ingestion to the destination containing stats
  // related to the ingestion.
  message IngestPairDataStatus {
    // The total count of audience members sent in the upload request for the
    // destination. Includes all audience members in the request, regardless of
    // whether they were successfully ingested or not.
    int64 record_count = 1;

    // The total count of pair ids sent in the upload request for the
    // destination. Includes all pair ids in the request, regardless of
    // whether they were successfully ingested or not.
    int64 pair_id_count = 2;
  }

  // The status of the pair data removal from the destination.
  message RemovePairDataStatus {
    // The total count of audience members sent in the removal request. Includes
    // all audience members in the request, regardless of whether they were
    // successfully removed or not.
    int64 record_count = 1;

    // The total count of pair ids sent in the removal request. Includes all
    // pair ids in the request, regardless of whether they were successfully
    // removed or not.
    int64 pair_id_count = 2;
  }

  // The status of the user id data ingestion to the destination containing
  // stats related to the ingestion.
  message IngestUserIdDataStatus {
    // The total count of audience members sent in the upload request for the
    // destination. Includes all audience members in the request, regardless of
    // whether they were successfully ingested or not.
    int64 record_count = 1;

    // The total count of user ids sent in the upload request for the
    // destination. Includes all user ids in the request, regardless of
    // whether they were successfully ingested or not.
    int64 user_id_count = 2;
  }

  // The status of the user id data removal from the destination.
  message RemoveUserIdDataStatus {
    // The total count of audience members sent in the removal request. Includes
    // all audience members in the request, regardless of whether they were
    // successfully removed or not.
    int64 record_count = 1;

    // The total count of user ids sent in the removal request. Includes all
    // user ids in the request, regardless of whether they were successfully
    // removed or not.
    int64 user_id_count = 2;
  }

  // The status of the ppid data ingestion to the destination containing stats
  // related to the ingestion.
  message IngestPpidDataStatus {
    // The total count of audience members sent in the upload request for the
    // destination. Includes all audience members in the request, regardless of
    // whether they were successfully ingested or not.
    int64 record_count = 1;

    // The total count of ppids sent in the upload request for the
    // destination. Includes all ppids in the request, regardless of
    // whether they were successfully ingested or not.
    int64 ppid_count = 2;
  }

  // The status of the ppid data removal from the destination.
  message RemovePpidDataStatus {
    // The total count of audience members sent in the removal request. Includes
    // all audience members in the request, regardless of whether they were
    // successfully removed or not.
    int64 record_count = 1;

    // The total count of ppids sent in the removal request. Includes all
    // ppids in the request, regardless of whether they were successfully
    // removed or not.
    int64 ppid_count = 2;
  }

  // The status of the composite data ingestion to the destination containing
  // stats related to the ingestion.
  message IngestCompositeDataStatus {
    // The total count of audience members sent in the upload request for the
    // destination. Includes all audience members in the request, regardless of
    // whether they were successfully ingested or not.
    int64 record_count = 1;

    // The total count of data types sent in the upload request for the
    // destination, broken down by data type. Includes all data types in
    // the request, regardless of whether they were successfully ingested or
    // not.
    repeated DataTypeCount data_type_counts = 2;

    // The match rate range of the upload.
    MatchRateRange upload_match_rate_range = 3;
  }

  // The status of the composite data removal from the destination.
  message RemoveCompositeDataStatus {
    // The total count of audience members sent in the removal request. Includes
    // all audience members in the request, regardless of whether they were
    // successfully removed or not.
    int64 record_count = 1;

    // The total count of data types sent in the removal request, broken down
    // by data type. Includes all data types in the request, regardless
    // of whether they were successfully removed or not.
    repeated DataTypeCount data_type_counts = 2;
  }

  // The count for a specific data type.
  message DataTypeCount {
    // The type of data.
    DataType type = 1;

    // The count for this data type.
    int64 count = 2;
  }

  // The type of data.
  enum DataType {
    // The data type is unspecified.
    DATA_TYPE_UNSPECIFIED = 0;

    // The data is an email address.
    EMAIL = 1;

    // The data is a phone number.
    PHONE_NUMBER = 2;

    // The data is a physical address.
    ADDRESS = 3;

    // The data is an IP address.
    IP_ADDRESS = 4;
  }

  // A destination within a DM API request.
  Destination destination = 1;

  // The request status of the destination.
  RequestStatus request_status = 2;

  // An error info error containing the error reason and error counts related to
  // the upload. Only populated if the
  // [`request_status`][google.ads.datamanager.v1.RequestStatusPerDestination.request_status]
  // is
  // [`FAILED`][google.ads.datamanager.v1.RequestStatusPerDestination.RequestStatus.FAILED]
  // or
  // [`PARTIAL_SUCCESS`][google.ads.datamanager.v1.RequestStatusPerDestination.RequestStatus.PARTIAL_SUCCESS].
  // This field isn't populated while the request has
  // [`request_status`][google.ads.datamanager.v1.RequestStatusPerDestination.request_status]
  // of
  // [`PROCESSING`][google.ads.datamanager.v1.RequestStatusPerDestination.RequestStatus.PROCESSING].
  ErrorInfo error_info = 3;

  // A warning info containing the warning reason and warning counts related to
  // the upload. This field isn't populated while the request has
  // [`request_status`][google.ads.datamanager.v1.RequestStatusPerDestination.request_status]
  // of
  // [`PROCESSING`][google.ads.datamanager.v1.RequestStatusPerDestination.RequestStatus.PROCESSING].
  WarningInfo warning_info = 7;

  // The status of the destination.
  oneof status {
    // The status of the ingest audience members request.
    IngestAudienceMembersStatus audience_members_ingestion_status = 4;

    // The status of the ingest events request.
    IngestEventsStatus events_ingestion_status = 5;

    // The status of the remove audience members request.
    RemoveAudienceMembersStatus audience_members_removal_status = 6;
  }
}
