// Copyright 2018 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.v0.common;

import "google/ads/googleads/v0/enums/age_range_type.proto";
import "google/ads/googleads/v0/enums/content_label_type.proto";
import "google/ads/googleads/v0/enums/day_of_week.proto";
import "google/ads/googleads/v0/enums/device.proto";
import "google/ads/googleads/v0/enums/gender_type.proto";
import "google/ads/googleads/v0/enums/hotel_date_selection_type.proto";
import "google/ads/googleads/v0/enums/income_range_type.proto";
import "google/ads/googleads/v0/enums/interaction_type.proto";
import "google/ads/googleads/v0/enums/keyword_match_type.proto";
import "google/ads/googleads/v0/enums/listing_custom_attribute_index.proto";
import "google/ads/googleads/v0/enums/listing_group_type.proto";
import "google/ads/googleads/v0/enums/minute_of_hour.proto";
import "google/ads/googleads/v0/enums/parental_status_type.proto";
import "google/ads/googleads/v0/enums/preferred_content_type.proto";
import "google/ads/googleads/v0/enums/product_channel.proto";
import "google/ads/googleads/v0/enums/product_channel_exclusivity.proto";
import "google/ads/googleads/v0/enums/product_condition.proto";
import "google/ads/googleads/v0/enums/product_type_level.proto";
import "google/ads/googleads/v0/enums/proximity_radius_units.proto";
import "google/protobuf/wrappers.proto";

option csharp_namespace = "Google.Ads.GoogleAds.V0.Common";
option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v0/common;common";
option java_multiple_files = true;
option java_outer_classname = "CriteriaProto";
option java_package = "com.google.ads.googleads.v0.common";
option objc_class_prefix = "GAA";
option php_namespace = "Google\\Ads\\GoogleAds\\V0\\Common";
// Proto file describing criteria types.

// A keyword criterion.
message KeywordInfo {
  // The text of the keyword (at most 80 characters and 10 words).
  google.protobuf.StringValue text = 1;

  // The match type of the keyword.
  google.ads.googleads.v0.enums.KeywordMatchTypeEnum.KeywordMatchType match_type = 2;
}

// A placement criterion. This can be used to modify bids for sites when
// targeting the content network.
message PlacementInfo {
  // URL of the placement.
  //
  // For example, "http://www.domain.com".
  google.protobuf.StringValue url = 1;
}

// A location criterion.
message LocationInfo {
  // The geo target constant resource name.
  google.protobuf.StringValue geo_target_constant = 1;
}

// A device criterion.
message DeviceInfo {
  // Type of the device.
  google.ads.googleads.v0.enums.DeviceEnum.Device type = 1;
}

// A preferred content criterion.
message PreferredContentInfo {
  // Type of the preferred content.
  google.ads.googleads.v0.enums.PreferredContentTypeEnum.PreferredContentType type = 2;
}

// A listing group criterion.
message ListingGroupInfo {
  // Type of the listing group.
  google.ads.googleads.v0.enums.ListingGroupTypeEnum.ListingGroupType type = 1;

  // Dimension value with which this listing group is refining its parent.
  // Undefined for the root group.
  ListingDimensionInfo case_value = 2;

  // Resource name of ad group criterion which is the parent listing group
  // subdivision. Null for the root group.
  google.protobuf.StringValue parent_ad_group_criterion = 3;
}

// A listing scope criterion.
message ListingScopeInfo {
  // Scope of the campaign criterion.
  repeated ListingDimensionInfo dimensions = 2;
}

// Listing dimensions for listing group criterion.
message ListingDimensionInfo {
  // Dimension of one of the types below is always present.
  oneof dimension {
    // Brand of the listing.
    ListingBrandInfo listing_brand = 1;

    // Advertiser-specific hotel ID.
    HotelIdInfo hotel_id = 2;

    // Class of the hotel as a number of stars 1 to 5.
    HotelClassInfo hotel_class = 3;

    // Country or Region the hotel is located in.
    HotelCountryRegionInfo hotel_country_region = 4;

    // State the hotel is located in.
    HotelStateInfo hotel_state = 5;

    // City the hotel is located in.
    HotelCityInfo hotel_city = 6;

    // Listing custom attribute.
    ListingCustomAttributeInfo listing_custom_attribute = 7;

    // Locality of a product offer.
    ProductChannelInfo product_channel = 8;

    // Availability of a product offer.
    ProductChannelExclusivityInfo product_channel_exclusivity = 9;

    // Condition of a product offer.
    ProductConditionInfo product_condition = 10;

    // Id of a product offer.
    ProductOfferIdInfo product_offer_id = 11;

    // Type of a product offer.
    ProductTypeInfo product_type = 12;
  }
}

// Brand of the listing.
message ListingBrandInfo {
  // String value of the listing brand.
  google.protobuf.StringValue value = 1;
}

// Advertiser-specific hotel ID.
message HotelIdInfo {
  // String value of the hotel ID.
  google.protobuf.StringValue value = 1;
}

// Class of the hotel as a number of stars 1 to 5.
message HotelClassInfo {
  // Long value of the hotel class.
  google.protobuf.Int64Value value = 1;
}

// Country or Region the hotel is located in.
message HotelCountryRegionInfo {
  // The Geo Target Constant resource name.
  google.protobuf.StringValue country_region_criterion = 1;
}

// State the hotel is located in.
message HotelStateInfo {
  // The Geo Target Constant resource name.
  google.protobuf.StringValue state_criterion = 1;
}

// City the hotel is located in.
message HotelCityInfo {
  // The Geo Target Constant resource name.
  google.protobuf.StringValue city_criterion = 1;
}

// Listing custom attribute.
message ListingCustomAttributeInfo {
  // String value of the listing custom attribute.
  google.protobuf.StringValue value = 1;

  // Indicates the index of the custom attribute.
  google.ads.googleads.v0.enums.ListingCustomAttributeIndexEnum.ListingCustomAttributeIndex index = 2;
}

// Locality of a product offer.
message ProductChannelInfo {
  // Value of the locality.
  google.ads.googleads.v0.enums.ProductChannelEnum.ProductChannel channel = 1;
}

// Availability of a product offer.
message ProductChannelExclusivityInfo {
  // Value of the availability.
  google.ads.googleads.v0.enums.ProductChannelExclusivityEnum.ProductChannelExclusivity channel_exclusivity = 1;
}

// Condition of a product offer.
message ProductConditionInfo {
  // Value of the condition.
  google.ads.googleads.v0.enums.ProductConditionEnum.ProductCondition condition = 1;
}

// Id of a product offer.
message ProductOfferIdInfo {
  // Value of the id.
  google.protobuf.StringValue value = 1;
}

// Type of a product offer.
message ProductTypeInfo {
  // Value of the type.
  google.protobuf.StringValue value = 1;

  // Level of the type.
  google.ads.googleads.v0.enums.ProductTypeLevelEnum.ProductTypeLevel level = 2;
}

// Criterion for hotel date selection (default dates vs. user selected).
message HotelDateSelectionTypeInfo {
  // Type of the hotel date selection
  google.ads.googleads.v0.enums.HotelDateSelectionTypeEnum.HotelDateSelectionType type = 1;
}

// Criterion for number of days prior to the stay the booking is being made.
message HotelAdvanceBookingWindowInfo {
  // Low end of the number of days prior to the stay.
  google.protobuf.Int64Value min_days = 1;

  // High end of the number of days prior to the stay.
  google.protobuf.Int64Value max_days = 2;
}

// Criterion for length of hotel stay in nights.
message HotelLengthOfStayInfo {
  // Low end of the number of nights in the stay.
  google.protobuf.Int64Value min_nights = 1;

  // High end of the number of nights in the stay.
  google.protobuf.Int64Value max_nights = 2;
}

// Criterion for day of the week the booking is for.
message HotelCheckInDayInfo {
  // The day of the week.
  google.ads.googleads.v0.enums.DayOfWeekEnum.DayOfWeek day_of_week = 1;
}

// Criterion for Interaction Type.
message InteractionTypeInfo {
  // The interaction type.
  google.ads.googleads.v0.enums.InteractionTypeEnum.InteractionType type = 1;
}

// Represents an AdSchedule criterion.
//
// AdSchedule is specified as the day of the week and a time interval
// within which ads will be shown.
//
// No more than six AdSchedules can be added for the same day.
message AdScheduleInfo {
  // Minutes after the start hour at which this schedule starts.
  //
  // This field is required for CREATE operations and is prohibited on UPDATE
  // operations.
  google.ads.googleads.v0.enums.MinuteOfHourEnum.MinuteOfHour start_minute = 1;

  // Minutes after the end hour at which this schedule ends. The schedule is
  // exclusive of the end minute.
  //
  // This field is required for CREATE operations and is prohibited on UPDATE
  // operations.
  google.ads.googleads.v0.enums.MinuteOfHourEnum.MinuteOfHour end_minute = 2;

  // Starting hour in 24 hour time.
  // This field must be between 0 and 23, inclusive.
  //
  // This field is required for CREATE operations and is prohibited on UPDATE
  // operations.
  google.protobuf.Int32Value start_hour = 3;

  // Ending hour in 24 hour time; 24 signifies end of the day.
  // This field must be between 0 and 24, inclusive.
  //
  // This field is required for CREATE operations and is prohibited on UPDATE
  // operations.
  google.protobuf.Int32Value end_hour = 4;

  // Day of the week the schedule applies to.
  //
  // This field is required for CREATE operations and is prohibited on UPDATE
  // operations.
  google.ads.googleads.v0.enums.DayOfWeekEnum.DayOfWeek day_of_week = 5;
}

// An age range criterion.
message AgeRangeInfo {
  // Type of the age range.
  google.ads.googleads.v0.enums.AgeRangeTypeEnum.AgeRangeType type = 1;
}

// A gender criterion.
message GenderInfo {
  // Type of the gender.
  google.ads.googleads.v0.enums.GenderTypeEnum.GenderType type = 1;
}

// An income range criterion.
message IncomeRangeInfo {
  // Type of the income range.
  google.ads.googleads.v0.enums.IncomeRangeTypeEnum.IncomeRangeType type = 1;
}

// A parental status criterion.
message ParentalStatusInfo {
  // Type of the parental status.
  google.ads.googleads.v0.enums.ParentalStatusTypeEnum.ParentalStatusType type = 1;
}

// A YouTube Video criterion.
message YouTubeVideoInfo {
  // YouTube video id as it appears on the YouTube watch page.
  google.protobuf.StringValue video_id = 1;
}

// A YouTube Channel criterion.
message YouTubeChannelInfo {
  // The YouTube uploader channel id or the channel code of a YouTube channel.
  google.protobuf.StringValue channel_id = 1;
}

// A User List criterion. Represents a user list that is defined by the
// advertiser to be targeted.
message UserListInfo {
  // The User List resource name.
  google.protobuf.StringValue user_list = 1;
}

// A Proximity criterion. The geo point and radius determine what geographical
// area is included. The address is a description of the geo point that does
// not affect ad serving.
//
// There are two ways to create a proximity. First, by setting an address
// and radius. The geo point will be automatically computed. Second, by
// setting a geo point and radius. The address is an optional label that won't
// be validated.
message ProximityInfo {
  // Latitude and longitude.
  GeoPointInfo geo_point = 1;

  // The radius of the proximity.
  google.protobuf.DoubleValue radius = 2;

  // The unit of measurement of the radius. Default is KILOMETERS.
  google.ads.googleads.v0.enums.ProximityRadiusUnitsEnum.ProximityRadiusUnits radius_units = 3;

  // Full address.
  AddressInfo address = 4;
}

// Geo point for proximity criterion.
message GeoPointInfo {
  // Micro degrees for the longitude.
  google.protobuf.Int32Value longitude_in_micro_degrees = 1;

  // Micro degrees for the latitude.
  google.protobuf.Int32Value latitude_in_micro_degrees = 2;
}

// Address for proximity criterion.
message AddressInfo {
  // Postal code.
  google.protobuf.StringValue postal_code = 1;

  // Province or state code.
  google.protobuf.StringValue province_code = 2;

  // Country code.
  google.protobuf.StringValue country_code = 3;

  // Province or state name.
  google.protobuf.StringValue province_name = 4;

  // Street address line 1.
  google.protobuf.StringValue street_address = 5;

  // Street address line 2. This field is write-only. It is only used for
  // calculating the longitude and latitude of an address when geo_point is
  // empty.
  google.protobuf.StringValue street_address2 = 6;

  // Name of the city.
  google.protobuf.StringValue city_name = 7;
}

// A topic criterion. Use topics to target or exclude placements in the
// Google Display Network based on the category into which the placement falls
// (for example, "Pets & Animals/Pets/Dogs").
message TopicInfo {
  // The Topic Constant resource name.
  google.protobuf.StringValue topic_constant = 1;

  // The category to target or exclude. Each subsequent element in the array
  // describes a more specific sub-category. For example,
  // "Pets & Animals", "Pets", "Dogs" represents the "Pets & Animals/Pets/Dogs"
  // category.
  repeated google.protobuf.StringValue path = 2;
}

// A language criterion.
message LanguageInfo {
  // The language constant resource name.
  google.protobuf.StringValue language_constant = 1;
}

// An IpBlock criterion used for IP exclusions. We allow:
//  - IPv4 and IPv6 addresses
//  - individual addresses (192.168.0.1)
//  - masks for individual addresses (192.168.0.1/32)
//  - masks for Class C networks (192.168.0.1/24)
message IpBlockInfo {
  // The IP address of this IP block.
  google.protobuf.StringValue ip_address = 1;
}

// Content Label for category exclusion.
message ContentLabelInfo {
  // Content label type, required for CREATE operations.
  google.ads.googleads.v0.enums.ContentLabelTypeEnum.ContentLabelType type = 1;
}

// Represents a Carrier Criterion.
message CarrierInfo {
  // The Carrier constant resource name.
  google.protobuf.StringValue carrier_constant = 1;
}

// Represents a particular interest-based topic to be targeted.
message UserInterestInfo {
  // The UserInterest resource name.
  google.protobuf.StringValue user_interest_category = 1;
}
