// 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.v24.resources;

import "google/ads/googleads/v24/enums/asset_field_type.proto";
import "google/ads/googleads/v24/enums/bidding_strategy_type.proto";
import "google/ads/googleads/v24/enums/experiment_asset_detail_operation.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option csharp_namespace = "Google.Ads.GoogleAds.V24.Resources";
option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v24/resources;resources";
option java_multiple_files = true;
option java_outer_classname = "ExperimentArmProto";
option java_package = "com.google.ads.googleads.v24.resources";
option objc_class_prefix = "GAA";
option php_namespace = "Google\\Ads\\GoogleAds\\V24\\Resources";
option ruby_package = "Google::Ads::GoogleAds::V24::Resources";

// Proto file describing the Experiment arm resource.

// A Google ads experiment for users to experiment changes on multiple
// campaigns, compare the performance, and apply the effective changes.
message ExperimentArm {
  option (google.api.resource) = {
    type: "googleads.googleapis.com/ExperimentArm"
    pattern: "customers/{customer_id}/experimentArms/{trial_id}~{trial_arm_id}"
  };

  // Details of assets associated with the experimental copies of
  // ads.
  message AssetTestingInfo {
    // Details of assets associated for each experimental copy of the ad.
    repeated AssetVariationInfo asset_variation_infos = 1;
  }

  // Details of asset variations to be performed on an ad in the control ad
  // group.
  message AssetVariationInfo {
    // Associated base AdGroup resource name.
    string base_ad_group = 1 [(google.api.resource_reference) = {
      type: "googleads.googleapis.com/AdGroup"
    }];

    // Associated base ad resource name.
    string base_ad = 2 [
      (google.api.resource_reference) = { type: "googleads.googleapis.com/Ad" }
    ];

    // Details for each asset that is being modified from the base
    // ad.
    repeated AssetDetail asset_details = 3;
  }

  // Details of an asset modification for the experiment ad, such as adding or
  // removing the asset.
  message AssetDetail {
    // The asset that is being modified for the experiment.
    string asset = 1 [(google.api.resource_reference) = {
      type: "googleads.googleapis.com/Asset"
    }];

    // Field type for the asset.
    google.ads.googleads.v24.enums.AssetFieldTypeEnum.AssetFieldType
        field_type = 2;

    // Enum to specify whether the asset is removed or added from the base
    // ad.
    google.ads.googleads.v24.enums.ExperimentAssetDetailOperationEnum
        .ExperimentAssetDetailOperation asset_detail_operation = 3;
  }

  // Holds the asset groups included in an arm of an Optimize Assets experiment.
  message AssetGroupInfo {
    // Asset group resource name.
    string asset_group = 1 [(google.api.resource_reference) = {
      type: "googleads.googleapis.com/AssetGroup"
    }];

    // List of asset group assets under the asset group.
    repeated AssetGroupAssetInfo asset_group_assets = 2;
  }

  // Holds the details of an asset within an asset group for an Optimize Assets
  // experiment arm.
  message AssetGroupAssetInfo {
    // Asset resource name of the asset group asset.
    string asset = 1 [(google.api.resource_reference) = {
      type: "googleads.googleapis.com/Asset"
    }];

    // Field type of the asset group asset.
    google.ads.googleads.v24.enums.AssetFieldTypeEnum.AssetFieldType
        field_type = 2;
  }

  // Parameters for an experiment to create a Performance Max campaign.
  // The experimental Performance Max campaign gets created automatically
  // based on the existing SHOPPING campaign settings and the settings
  // specified in this field.
  message ExperimentalPerformanceMaxCampaignSettings {
    // Immutable. The amount of budget of the Performance Max experiment
    // campaign.
    int64 budget_amount_micros = 1 [(google.api.field_behavior) = IMMUTABLE];

    // Immutable. Target ROAS of the Performance Max experiment campaign.
    double target_roas = 2 [(google.api.field_behavior) = IMMUTABLE];

    // Immutable. Target CPA of the Performance Max experiment campaign.
    int64 target_cpa_micros = 3 [(google.api.field_behavior) = IMMUTABLE];

    // Immutable. Bidding strategy type of the Performance Max experiment
    // campaign.
    google.ads.googleads.v24.enums.BiddingStrategyTypeEnum.BiddingStrategyType
        bidding_strategy_type = 4 [(google.api.field_behavior) = IMMUTABLE];
  }

  // Information specific to the control or treatment campaign of a Performance
  // Max experiment.
  message PerformanceMaxExperimentArmInfo {
    // Immutable. Performance Max campaign settings to be applied on the
    // Google-created experimental campaign in a Performance Max experiment. The
    // experimental campaign is automatically created by Google upon experiment
    // creation.
    ExperimentalPerformanceMaxCampaignSettings
        experimental_performance_max_campaign_settings = 1
        [(google.api.field_behavior) = IMMUTABLE];
  }

  // Immutable. The resource name of the experiment arm.
  // Experiment arm resource names have the form:
  //
  // `customers/{customer_id}/experimentArms/{TrialArm.trial_id}~{TrialArm.trial_arm_id}`
  string resource_name = 1 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "googleads.googleapis.com/ExperimentArm"
    }
  ];

  // Immutable. The experiment to which the ExperimentArm belongs.
  string experiment = 8 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "googleads.googleapis.com/Experiment"
    }
  ];

  // Required. The name of the experiment arm. It must have a minimum length of
  // 1 and maximum length of 1024. It must be unique under an experiment.
  string name = 3 [(google.api.field_behavior) = REQUIRED];

  // Whether this arm is a control arm. A control arm is the arm against
  // which the other arms are compared.
  bool control = 4;

  // Traffic split of the trial arm. The value should be between 1 and 100
  // and must total 100 between the two trial arms.
  int64 traffic_split = 5;

  // List of campaigns in the trial arm. The max length is one.
  repeated string campaigns = 6 [(google.api.resource_reference) = {
    type: "googleads.googleapis.com/Campaign"
  }];

  // Output only. The in design campaigns in the treatment experiment arm.
  repeated string in_design_campaigns = 7 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "googleads.googleapis.com/Campaign"
    }
  ];

  // Details of assets under experiment.
  AssetTestingInfo asset_testing_info = 9;

  // List of asset groups in the experiment arm.
  repeated AssetGroupInfo asset_groups = 10;

  // Immutable. Information specific to the control or treatment campaign of a
  // Performance Max experiment.
  //
  // This field is specific to experiments of type PMAX_REPLACEMENT_SHOPPING.
  // For example, the treatment experiment arm contains the
  // information of treatment Performance Max campaign settings for
  // PMAX_REPLACEMENT_SHOPPING experiments.
  PerformanceMaxExperimentArmInfo performance_max_experiment_arm_info = 11
      [(google.api.field_behavior) = IMMUTABLE];
}
