// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.ads.googleads.v7.common;

import "google/ads/googleads/v7/common/criteria.proto";
import "google/ads/googleads/v7/common/feed_common.proto";
import "google/ads/googleads/v7/enums/lead_form_call_to_action_type.proto";
import "google/ads/googleads/v7/enums/lead_form_desired_intent.proto";
import "google/ads/googleads/v7/enums/lead_form_field_user_input_type.proto";
import "google/ads/googleads/v7/enums/lead_form_post_submit_call_to_action_type.proto";
import "google/ads/googleads/v7/enums/mime_type.proto";
import "google/ads/googleads/v7/enums/promotion_extension_discount_modifier.proto";
import "google/ads/googleads/v7/enums/promotion_extension_occasion.proto";
import "google/api/field_behavior.proto";
import "google/api/annotations.proto";

option csharp_namespace = "Google.Ads.GoogleAds.V7.Common";
option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v7/common;common";
option java_multiple_files = true;
option java_outer_classname = "AssetTypesProto";
option java_package = "com.google.ads.googleads.v7.common";
option objc_class_prefix = "GAA";
option php_namespace = "Google\\Ads\\GoogleAds\\V7\\Common";
option ruby_package = "Google::Ads::GoogleAds::V7::Common";

// Proto file containing info messages for specific asset types.

// A YouTube asset.
message YoutubeVideoAsset {
  // YouTube video id. This is the 11 character string value used in the
  // YouTube video URL.
  optional string youtube_video_id = 2;

  // YouTube video title.
  string youtube_video_title = 3;
}

// A MediaBundle asset.
message MediaBundleAsset {
  // Media bundle (ZIP file) asset data. The format of the uploaded ZIP file
  // depends on the ad field where it will be used. For more information on the
  // format, see the documentation of the ad field where you plan on using the
  // MediaBundleAsset. This field is mutate only.
  optional bytes data = 2;
}

// An Image asset.
message ImageAsset {
  // The raw bytes data of an image. This field is mutate only.
  optional bytes data = 5;

  // File size of the image asset in bytes.
  optional int64 file_size = 6;

  // MIME type of the image asset.
  google.ads.googleads.v7.enums.MimeTypeEnum.MimeType mime_type = 3;

  // Metadata for this image at its original size.
  ImageDimension full_size = 4;
}

// Metadata for an image at a certain size, either original or resized.
message ImageDimension {
  // Height of the image.
  optional int64 height_pixels = 4;

  // Width of the image.
  optional int64 width_pixels = 5;

  // A URL that returns the image with this height and width.
  optional string url = 6;
}

// A Text asset.
message TextAsset {
  // Text content of the text asset.
  optional string text = 2;
}

// A Lead Form asset.
message LeadFormAsset {
  // Required. The name of the business being advertised.
  string business_name = 10 [(google.api.field_behavior) = REQUIRED];

  // Required. Pre-defined display text that encourages user to expand the form.
  google.ads.googleads.v7.enums.LeadFormCallToActionTypeEnum.LeadFormCallToActionType call_to_action_type = 17 [(google.api.field_behavior) = REQUIRED];

  // Required. Text giving a clear value proposition of what users expect once they expand
  // the form.
  string call_to_action_description = 18 [(google.api.field_behavior) = REQUIRED];

  // Required. Headline of the expanded form to describe what the form is asking for or
  // facilitating.
  string headline = 12 [(google.api.field_behavior) = REQUIRED];

  // Required. Detailed description of the expanded form to describe what the form is
  // asking for or facilitating.
  string description = 13 [(google.api.field_behavior) = REQUIRED];

  // Required. Link to a page describing the policy on how the collected data is handled
  // by the advertiser/business.
  string privacy_policy_url = 14 [(google.api.field_behavior) = REQUIRED];

  // Headline of text shown after form submission that describes how the
  // advertiser will follow up with the user.
  optional string post_submit_headline = 15;

  // Detailed description shown after form submission that describes how the
  // advertiser will follow up with the user.
  optional string post_submit_description = 16;

  // Ordered list of input fields.
  repeated LeadFormField fields = 8;

  // Configured methods for collected lead data to be delivered to advertiser.
  // Only one method typed as WebhookDelivery can be configured.
  repeated LeadFormDeliveryMethod delivery_methods = 9;

  // Pre-defined display text that encourages user action after the form is
  // submitted.
  google.ads.googleads.v7.enums.LeadFormPostSubmitCallToActionTypeEnum.LeadFormPostSubmitCallToActionType post_submit_call_to_action_type = 19;

  // Asset resource name of the background image. The minimum size is 600x314
  // and the aspect ratio must be 1.91:1 (+-1%).
  optional string background_image_asset = 20;

  // Desired intent for the lead form, e.g. more volume or higher intent.
  google.ads.googleads.v7.enums.LeadFormDesiredIntentEnum.LeadFormDesiredIntent desired_intent = 21;

  // Custom disclosure shown along with Google disclaimer on the lead form.
  // Accessible to allowed customers only.
  optional string custom_disclosure = 22;
}

// One input field instance within a form.
message LeadFormField {
  // Describes the input type, which may be a predefined type such as
  // "full name" or a pre-vetted question like "Do you own a car?".
  google.ads.googleads.v7.enums.LeadFormFieldUserInputTypeEnum.LeadFormFieldUserInputType input_type = 1;

  // Defines answer configuration that this form field accepts. If oneof is not
  // set, this is a free-text answer.
  oneof answers {
    // Answer configuration for a single choice question. Can be set only for
    // pre-vetted question fields. Minimum of 2 answers required and maximum of
    // 12 allowed.
    LeadFormSingleChoiceAnswers single_choice_answers = 2;
  }
}

// Defines possible answers for a single choice question, usually presented as
// a single-choice drop-down list.
message LeadFormSingleChoiceAnswers {
  // List of choices for a single question field. The order of entries defines
  // UI order. Minimum of 2 answers required and maximum of 12 allowed.
  repeated string answers = 1;
}

// A configuration of how leads are delivered to the advertiser.
message LeadFormDeliveryMethod {
  // Various subtypes of delivery.
  oneof delivery_details {
    // Webhook method of delivery.
    WebhookDelivery webhook = 1;
  }
}

// Google notifies the advertiser of leads by making HTTP calls to an
// endpoint they specify. The requests contain JSON matching a schema that
// Google publishes as part of form ads documentation.
message WebhookDelivery {
  // Webhook url specified by advertiser to send the lead.
  optional string advertiser_webhook_url = 4;

  // Anti-spoofing secret set by the advertiser as part of the webhook payload.
  optional string google_secret = 5;

  // The schema version that this delivery instance will use.
  optional int64 payload_schema_version = 6;
}

// A Book on Google asset. Used to redirect user to book through Google.
// Book on Google will change the redirect url to book directly through
// Google.
message BookOnGoogleAsset {

}

// A Promotion asset.
message PromotionAsset {
  // Required. A freeform description of what the promotion is targeting.
  string promotion_target = 1 [(google.api.field_behavior) = REQUIRED];

  // A modifier for qualification of the discount.
  google.ads.googleads.v7.enums.PromotionExtensionDiscountModifierEnum.PromotionExtensionDiscountModifier discount_modifier = 2;

  // Start date of when the promotion is eligible to be redeemed, in yyyy-MM-dd
  // format.
  string redemption_start_date = 7;

  // Last date of when the promotion is eligible to be redeemed, in yyyy-MM-dd
  // format.
  string redemption_end_date = 8;

  // The occasion the promotion was intended for.
  // If an occasion is set, the redemption window will need to fall within the
  // date range associated with the occasion.
  google.ads.googleads.v7.enums.PromotionExtensionOccasionEnum.PromotionExtensionOccasion occasion = 9;

  // The language of the promotion.
  // Represented as BCP 47 language tag.
  string language_code = 10;

  // Start date of when this asset is effective and can begin serving, in
  // yyyy-MM-dd format.
  string start_date = 11;

  // Last date of when this asset is effective and still serving, in yyyy-MM-dd
  // format.
  string end_date = 12;

  // List of non-overlapping schedules specifying all time intervals for which
  // the asset may serve. There can be a maximum of 6 schedules per day, 42 in
  // total.
  repeated AdScheduleInfo ad_schedule_targets = 13;

  // Discount type, can be percentage off or amount off.
  oneof discount_type {
    // Percentage off discount in the promotion. 1,000,000 = 100%.
    // Either this or money_amount_off is required.
    int64 percent_off = 3;

    // Money amount off for discount in the promotion.
    // Either this or percent_off is required.
    Money money_amount_off = 4;
  }

  // Promotion trigger. Can be by promotion code or promo by eligible order
  // amount.
  oneof promotion_trigger {
    // A code the user should use in order to be eligible for the promotion.
    string promotion_code = 5;

    // The amount the total order needs to be for the user to be eligible for
    // the promotion.
    Money orders_over_amount = 6;
  }
}

// A Callout asset.
message CalloutAsset {
  // Required. The callout text.
  // The length of this string should be between 1 and 25, inclusive.
  string callout_text = 1 [(google.api.field_behavior) = REQUIRED];

  // Start date of when this asset is effective and can begin serving, in
  // yyyy-MM-dd format.
  string start_date = 2;

  // Last date of when this asset is effective and still serving, in yyyy-MM-dd
  // format.
  string end_date = 3;

  // List of non-overlapping schedules specifying all time intervals for which
  // the asset may serve. There can be a maximum of 6 schedules per day, 42 in
  // total.
  repeated AdScheduleInfo ad_schedule_targets = 4;
}

// A Structured Snippet asset.
message StructuredSnippetAsset {
  // Required. The header of the snippet.
  // This string should be one of the predefined values at
  // https://developers.google.com/google-ads/api/reference/data/structured-snippet-headers
  string header = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The values in the snippet.
  // The size of this collection should be between 3 and 10, inclusive.
  // The length of each value should be between 1 and 25 characters, inclusive.
  repeated string values = 2 [(google.api.field_behavior) = REQUIRED];
}

// A Sitelink asset.
message SitelinkAsset {
  // Required. URL display text for the sitelink.
  // The length of this string should be between 1 and 25, inclusive.
  string link_text = 1 [(google.api.field_behavior) = REQUIRED];

  // First line of the description for the sitelink.
  // If set, the length should be between 1 and 35, inclusive, and description2
  // must also be set.
  string description1 = 2;

  // Second line of the description for the sitelink.
  // If set, the length should be between 1 and 35, inclusive, and description1
  // must also be set.
  string description2 = 3;

  // Start date of when this asset is effective and can begin serving, in
  // yyyy-MM-dd format.
  string start_date = 4;

  // Last date of when this asset is effective and still serving, in yyyy-MM-dd
  // format.
  string end_date = 5;

  // List of non-overlapping schedules specifying all time intervals for which
  // the asset may serve. There can be a maximum of 6 schedules per day, 42 in
  // total.
  repeated AdScheduleInfo ad_schedule_targets = 6;
}
