/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.businessprofileperformance.v1;

/**
 * Service definition for BusinessProfilePerformance (v1).
 *
 * <p>
 * The Business Profile Performance API allows merchants to fetch performance reports about their business profile on Google.
 * </p>
 *
 * <p>
 * For more information about this service, see the
 * <a href="https://developers.google.com/my-business/" target="_blank">API Documentation</a>
 * </p>
 *
 * <p>
 * This service uses {@link BusinessProfilePerformanceRequestInitializer} to initialize global parameters via its
 * {@link Builder}.
 * </p>
 *
 * @since 1.3
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public class BusinessProfilePerformance extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {

  // Note: Leave this static initializer at the top of the file.
  static {
    com.google.api.client.util.Preconditions.checkState(
        com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
        (com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 32 ||
        (com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION == 31 &&
        com.google.api.client.googleapis.GoogleUtils.BUGFIX_VERSION >= 1)),
        "You are currently running with version %s of google-api-client. " +
        "You need at least version 1.31.1 of google-api-client to run version " +
        "1.32.1 of the Business Profile Performance API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
  }

  /**
   * The default encoded root URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   *
   * @since 1.7
   */
  public static final String DEFAULT_ROOT_URL = "https://businessprofileperformance.googleapis.com/";

  /**
   * The default encoded mTLS root URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   *
   * @since 1.31
   */
  public static final String DEFAULT_MTLS_ROOT_URL = "https://businessprofileperformance.mtls.googleapis.com/";

  /**
   * The default encoded service path of the service. This is determined when the library is
   * generated and normally should not be changed.
   *
   * @since 1.7
   */
  public static final String DEFAULT_SERVICE_PATH = "";

  /**
   * The default encoded batch path of the service. This is determined when the library is
   * generated and normally should not be changed.
   *
   * @since 1.23
   */
  public static final String DEFAULT_BATCH_PATH = "batch";

  /**
   * The default encoded base URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   */
  public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;

  /**
   * Constructor.
   *
   * <p>
   * Use {@link Builder} if you need to specify any of the optional parameters.
   * </p>
   *
   * @param transport HTTP transport, which should normally be:
   *        <ul>
   *        <li>Google App Engine:
   *        {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
   *        <li>Android: {@code newCompatibleTransport} from
   *        {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
   *        <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
   *        </li>
   *        </ul>
   * @param jsonFactory JSON factory, which may be:
   *        <ul>
   *        <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
   *        <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
   *        <li>Android Honeycomb or higher:
   *        {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
   *        </ul>
   * @param httpRequestInitializer HTTP request initializer or {@code null} for none
   * @since 1.7
   */
  public BusinessProfilePerformance(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
      com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
    this(new Builder(transport, jsonFactory, httpRequestInitializer));
  }

  /**
   * @param builder builder
   */
  BusinessProfilePerformance(Builder builder) {
    super(builder);
  }

  @Override
  protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException {
    super.initialize(httpClientRequest);
  }

  /**
   * An accessor for creating requests from the Locations collection.
   *
   * <p>The typical use is:</p>
   * <pre>
   *   {@code BusinessProfilePerformance businessprofileperformance = new BusinessProfilePerformance(...);}
   *   {@code BusinessProfilePerformance.Locations.List request = businessprofileperformance.locations().list(parameters ...)}
   * </pre>
   *
   * @return the resource collection
   */
  public Locations locations() {
    return new Locations();
  }

  /**
   * The "locations" collection of methods.
   */
  public class Locations {

    /**
     * Returns the values for each date from a given time range that are associated with the specific
     * daily metric. Example request: `GET https://businessprofileperformance.googleapis.com/v1/location
     * s/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS_range.start_date.year=2022_range.sta
     * rt_date.month=1_range.start_date.day=1_range.end_date.year=2022_range.end_date.month=3_range.end_
     * date.day=31`
     *
     * Create a request for the method "locations.getDailyMetricsTimeSeries".
     *
     * This request holds the parameters needed by the businessprofileperformance server.  After setting
     * any optional parameters, call the {@link GetDailyMetricsTimeSeries#execute()} method to invoke
     * the remote operation.
     *
     * @param name Required. The location for which the time series should be fetched. Format: locations/{location_id}
     *        where location_id is an unobfuscated listing id.
     * @return the request
     */
    public GetDailyMetricsTimeSeries getDailyMetricsTimeSeries(java.lang.String name) throws java.io.IOException {
      GetDailyMetricsTimeSeries result = new GetDailyMetricsTimeSeries(name);
      initialize(result);
      return result;
    }

    public class GetDailyMetricsTimeSeries extends BusinessProfilePerformanceRequest<com.google.api.services.businessprofileperformance.v1.model.GetDailyMetricsTimeSeriesResponse> {

      private static final String REST_PATH = "v1/{+name}:getDailyMetricsTimeSeries";

      private final java.util.regex.Pattern NAME_PATTERN =
          java.util.regex.Pattern.compile("^locations/[^/]+$");

      /**
       * Returns the values for each date from a given time range that are associated with the specific
       * daily metric. Example request: `GET https://businessprofileperformance.googleapis.com/v1/locati
       * ons/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS_range.start_date.year=2022_range
       * .start_date.month=1_range.start_date.day=1_range.end_date.year=2022_range.end_date.month=3_rang
       * e.end_date.day=31`
       *
       * Create a request for the method "locations.getDailyMetricsTimeSeries".
       *
       * This request holds the parameters needed by the the businessprofileperformance server.  After
       * setting any optional parameters, call the {@link GetDailyMetricsTimeSeries#execute()} method to
       * invoke the remote operation. <p> {@link GetDailyMetricsTimeSeries#initialize(com.google.api.cli
       * ent.googleapis.services.AbstractGoogleClientRequest)} must be called to initialize this
       * instance immediately after invoking the constructor. </p>
       *
       * @param name Required. The location for which the time series should be fetched. Format: locations/{location_id}
     *        where location_id is an unobfuscated listing id.
       * @since 1.13
       */
      protected GetDailyMetricsTimeSeries(java.lang.String name) {
        super(BusinessProfilePerformance.this, "GET", REST_PATH, null, com.google.api.services.businessprofileperformance.v1.model.GetDailyMetricsTimeSeriesResponse.class);
        this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
        if (!getSuppressPatternChecks()) {
          com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
              "Parameter name must conform to the pattern " +
              "^locations/[^/]+$");
        }
      }

      @Override
      public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
        return super.executeUsingHead();
      }

      @Override
      public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
        return super.buildHttpRequestUsingHead();
      }

      @Override
      public GetDailyMetricsTimeSeries set$Xgafv(java.lang.String $Xgafv) {
        return (GetDailyMetricsTimeSeries) super.set$Xgafv($Xgafv);
      }

      @Override
      public GetDailyMetricsTimeSeries setAccessToken(java.lang.String accessToken) {
        return (GetDailyMetricsTimeSeries) super.setAccessToken(accessToken);
      }

      @Override
      public GetDailyMetricsTimeSeries setAlt(java.lang.String alt) {
        return (GetDailyMetricsTimeSeries) super.setAlt(alt);
      }

      @Override
      public GetDailyMetricsTimeSeries setCallback(java.lang.String callback) {
        return (GetDailyMetricsTimeSeries) super.setCallback(callback);
      }

      @Override
      public GetDailyMetricsTimeSeries setFields(java.lang.String fields) {
        return (GetDailyMetricsTimeSeries) super.setFields(fields);
      }

      @Override
      public GetDailyMetricsTimeSeries setKey(java.lang.String key) {
        return (GetDailyMetricsTimeSeries) super.setKey(key);
      }

      @Override
      public GetDailyMetricsTimeSeries setOauthToken(java.lang.String oauthToken) {
        return (GetDailyMetricsTimeSeries) super.setOauthToken(oauthToken);
      }

      @Override
      public GetDailyMetricsTimeSeries setPrettyPrint(java.lang.Boolean prettyPrint) {
        return (GetDailyMetricsTimeSeries) super.setPrettyPrint(prettyPrint);
      }

      @Override
      public GetDailyMetricsTimeSeries setQuotaUser(java.lang.String quotaUser) {
        return (GetDailyMetricsTimeSeries) super.setQuotaUser(quotaUser);
      }

      @Override
      public GetDailyMetricsTimeSeries setUploadType(java.lang.String uploadType) {
        return (GetDailyMetricsTimeSeries) super.setUploadType(uploadType);
      }

      @Override
      public GetDailyMetricsTimeSeries setUploadProtocol(java.lang.String uploadProtocol) {
        return (GetDailyMetricsTimeSeries) super.setUploadProtocol(uploadProtocol);
      }

      /**
       * Required. The location for which the time series should be fetched. Format:
       * locations/{location_id} where location_id is an unobfuscated listing id.
       */
      @com.google.api.client.util.Key
      private java.lang.String name;

      /** Required. The location for which the time series should be fetched. Format: locations/{location_id}
     where location_id is an unobfuscated listing id.
       */
      public java.lang.String getName() {
        return name;
      }

      /**
       * Required. The location for which the time series should be fetched. Format:
       * locations/{location_id} where location_id is an unobfuscated listing id.
       */
      public GetDailyMetricsTimeSeries setName(java.lang.String name) {
        if (!getSuppressPatternChecks()) {
          com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
              "Parameter name must conform to the pattern " +
              "^locations/[^/]+$");
        }
        this.name = name;
        return this;
      }

      /** Required. The metric to retrieve time series. */
      @com.google.api.client.util.Key
      private java.lang.String dailyMetric;

      /** Required. The metric to retrieve time series.
       */
      public java.lang.String getDailyMetric() {
        return dailyMetric;
      }

      /** Required. The metric to retrieve time series. */
      public GetDailyMetricsTimeSeries setDailyMetric(java.lang.String dailyMetric) {
        this.dailyMetric = dailyMetric;
        return this;
      }

      /**
       * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a
       * year by itself or a year and month where the day isn't significant.
       */
      @com.google.api.client.util.Key("dailyRange.endDate.day")
      private java.lang.Integer dailyRangeEndDateDay;

      /** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by
     itself or a year and month where the day isn't significant.
       */
      public java.lang.Integer getDailyRangeEndDateDay() {
        return dailyRangeEndDateDay;
      }

      /**
       * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a
       * year by itself or a year and month where the day isn't significant.
       */
      public GetDailyMetricsTimeSeries setDailyRangeEndDateDay(java.lang.Integer dailyRangeEndDateDay) {
        this.dailyRangeEndDateDay = dailyRangeEndDateDay;
        return this;
      }

      /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
      @com.google.api.client.util.Key("dailyRange.endDate.month")
      private java.lang.Integer dailyRangeEndDateMonth;

      /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
       */
      public java.lang.Integer getDailyRangeEndDateMonth() {
        return dailyRangeEndDateMonth;
      }

      /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
      public GetDailyMetricsTimeSeries setDailyRangeEndDateMonth(java.lang.Integer dailyRangeEndDateMonth) {
        this.dailyRangeEndDateMonth = dailyRangeEndDateMonth;
        return this;
      }

      /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
      @com.google.api.client.util.Key("dailyRange.endDate.year")
      private java.lang.Integer dailyRangeEndDateYear;

      /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
       */
      public java.lang.Integer getDailyRangeEndDateYear() {
        return dailyRangeEndDateYear;
      }

      /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
      public GetDailyMetricsTimeSeries setDailyRangeEndDateYear(java.lang.Integer dailyRangeEndDateYear) {
        this.dailyRangeEndDateYear = dailyRangeEndDateYear;
        return this;
      }

      /**
       * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a
       * year by itself or a year and month where the day isn't significant.
       */
      @com.google.api.client.util.Key("dailyRange.startDate.day")
      private java.lang.Integer dailyRangeStartDateDay;

      /** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by
     itself or a year and month where the day isn't significant.
       */
      public java.lang.Integer getDailyRangeStartDateDay() {
        return dailyRangeStartDateDay;
      }

      /**
       * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a
       * year by itself or a year and month where the day isn't significant.
       */
      public GetDailyMetricsTimeSeries setDailyRangeStartDateDay(java.lang.Integer dailyRangeStartDateDay) {
        this.dailyRangeStartDateDay = dailyRangeStartDateDay;
        return this;
      }

      /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
      @com.google.api.client.util.Key("dailyRange.startDate.month")
      private java.lang.Integer dailyRangeStartDateMonth;

      /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
       */
      public java.lang.Integer getDailyRangeStartDateMonth() {
        return dailyRangeStartDateMonth;
      }

      /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
      public GetDailyMetricsTimeSeries setDailyRangeStartDateMonth(java.lang.Integer dailyRangeStartDateMonth) {
        this.dailyRangeStartDateMonth = dailyRangeStartDateMonth;
        return this;
      }

      /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
      @com.google.api.client.util.Key("dailyRange.startDate.year")
      private java.lang.Integer dailyRangeStartDateYear;

      /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
       */
      public java.lang.Integer getDailyRangeStartDateYear() {
        return dailyRangeStartDateYear;
      }

      /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
      public GetDailyMetricsTimeSeries setDailyRangeStartDateYear(java.lang.Integer dailyRangeStartDateYear) {
        this.dailyRangeStartDateYear = dailyRangeStartDateYear;
        return this;
      }

      /** Represents the day of the week. Eg: MONDAY. */
      @com.google.api.client.util.Key("dailySubEntityType.dayOfWeek")
      private java.lang.String dailySubEntityTypeDayOfWeek;

      /** Represents the day of the week. Eg: MONDAY.
       */
      public java.lang.String getDailySubEntityTypeDayOfWeek() {
        return dailySubEntityTypeDayOfWeek;
      }

      /** Represents the day of the week. Eg: MONDAY. */
      public GetDailyMetricsTimeSeries setDailySubEntityTypeDayOfWeek(java.lang.String dailySubEntityTypeDayOfWeek) {
        this.dailySubEntityTypeDayOfWeek = dailySubEntityTypeDayOfWeek;
        return this;
      }

      /**
       * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the
       * value "24:00:00" for scenarios like business closing time.
       */
      @com.google.api.client.util.Key("dailySubEntityType.timeOfDay.hours")
      private java.lang.Integer dailySubEntityTypeTimeOfDayHours;

      /** Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value
     "24:00:00" for scenarios like business closing time.
       */
      public java.lang.Integer getDailySubEntityTypeTimeOfDayHours() {
        return dailySubEntityTypeTimeOfDayHours;
      }

      /**
       * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the
       * value "24:00:00" for scenarios like business closing time.
       */
      public GetDailyMetricsTimeSeries setDailySubEntityTypeTimeOfDayHours(java.lang.Integer dailySubEntityTypeTimeOfDayHours) {
        this.dailySubEntityTypeTimeOfDayHours = dailySubEntityTypeTimeOfDayHours;
        return this;
      }

      /** Minutes of hour of day. Must be from 0 to 59. */
      @com.google.api.client.util.Key("dailySubEntityType.timeOfDay.minutes")
      private java.lang.Integer dailySubEntityTypeTimeOfDayMinutes;

      /** Minutes of hour of day. Must be from 0 to 59.
       */
      public java.lang.Integer getDailySubEntityTypeTimeOfDayMinutes() {
        return dailySubEntityTypeTimeOfDayMinutes;
      }

      /** Minutes of hour of day. Must be from 0 to 59. */
      public GetDailyMetricsTimeSeries setDailySubEntityTypeTimeOfDayMinutes(java.lang.Integer dailySubEntityTypeTimeOfDayMinutes) {
        this.dailySubEntityTypeTimeOfDayMinutes = dailySubEntityTypeTimeOfDayMinutes;
        return this;
      }

      /** Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. */
      @com.google.api.client.util.Key("dailySubEntityType.timeOfDay.nanos")
      private java.lang.Integer dailySubEntityTypeTimeOfDayNanos;

      /** Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
       */
      public java.lang.Integer getDailySubEntityTypeTimeOfDayNanos() {
        return dailySubEntityTypeTimeOfDayNanos;
      }

      /** Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. */
      public GetDailyMetricsTimeSeries setDailySubEntityTypeTimeOfDayNanos(java.lang.Integer dailySubEntityTypeTimeOfDayNanos) {
        this.dailySubEntityTypeTimeOfDayNanos = dailySubEntityTypeTimeOfDayNanos;
        return this;
      }

      /**
       * Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value
       * 60 if it allows leap-seconds.
       */
      @com.google.api.client.util.Key("dailySubEntityType.timeOfDay.seconds")
      private java.lang.Integer dailySubEntityTypeTimeOfDaySeconds;

      /** Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it
     allows leap-seconds.
       */
      public java.lang.Integer getDailySubEntityTypeTimeOfDaySeconds() {
        return dailySubEntityTypeTimeOfDaySeconds;
      }

      /**
       * Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value
       * 60 if it allows leap-seconds.
       */
      public GetDailyMetricsTimeSeries setDailySubEntityTypeTimeOfDaySeconds(java.lang.Integer dailySubEntityTypeTimeOfDaySeconds) {
        this.dailySubEntityTypeTimeOfDaySeconds = dailySubEntityTypeTimeOfDaySeconds;
        return this;
      }

      @Override
      public GetDailyMetricsTimeSeries set(String parameterName, Object value) {
        return (GetDailyMetricsTimeSeries) super.set(parameterName, value);
      }
    }

    /**
     * An accessor for creating requests from the Searchkeywords collection.
     *
     * <p>The typical use is:</p>
     * <pre>
     *   {@code BusinessProfilePerformance businessprofileperformance = new BusinessProfilePerformance(...);}
     *   {@code BusinessProfilePerformance.Searchkeywords.List request = businessprofileperformance.searchkeywords().list(parameters ...)}
     * </pre>
     *
     * @return the resource collection
     */
    public Searchkeywords searchkeywords() {
      return new Searchkeywords();
    }

    /**
     * The "searchkeywords" collection of methods.
     */
    public class Searchkeywords {

      /**
       * An accessor for creating requests from the Impressions collection.
       *
       * <p>The typical use is:</p>
       * <pre>
       *   {@code BusinessProfilePerformance businessprofileperformance = new BusinessProfilePerformance(...);}
       *   {@code BusinessProfilePerformance.Impressions.List request = businessprofileperformance.impressions().list(parameters ...)}
       * </pre>
       *
       * @return the resource collection
       */
      public Impressions impressions() {
        return new Impressions();
      }

      /**
       * The "impressions" collection of methods.
       */
      public class Impressions {

        /**
         * An accessor for creating requests from the Monthly collection.
         *
         * <p>The typical use is:</p>
         * <pre>
         *   {@code BusinessProfilePerformance businessprofileperformance = new BusinessProfilePerformance(...);}
         *   {@code BusinessProfilePerformance.Monthly.List request = businessprofileperformance.monthly().list(parameters ...)}
         * </pre>
         *
         * @return the resource collection
         */
        public Monthly monthly() {
          return new Monthly();
        }

        /**
         * The "monthly" collection of methods.
         */
        public class Monthly {

          /**
           * Returns the search keywords used to find a business in search or maps. Each search keyword is
           * accompanied by impressions which are aggregated on a monthly basis. Example request: `GET https:/
           * /businessprofileperformance.googleapis.com/v1/locations/12345/searchkeywords/impressions/monthly?
           * monthly_range.start_month.year=2022_range.start_month.month=1_range.end_month.year=2022_range.end
           * _month.month=3`
           *
           * Create a request for the method "monthly.list".
           *
           * This request holds the parameters needed by the businessprofileperformance server.  After setting
           * any optional parameters, call the {@link List#execute()} method to invoke the remote operation.
           *
           * @param parent Required. The location for which the time series should be fetched. Format: locations/{location_id}
           *        where location_id is an unobfuscated listing id.
           * @return the request
           */
          public List list(java.lang.String parent) throws java.io.IOException {
            List result = new List(parent);
            initialize(result);
            return result;
          }

          public class List extends BusinessProfilePerformanceRequest<com.google.api.services.businessprofileperformance.v1.model.ListSearchKeywordImpressionsMonthlyResponse> {

            private static final String REST_PATH = "v1/{+parent}/searchkeywords/impressions/monthly";

            private final java.util.regex.Pattern PARENT_PATTERN =
                java.util.regex.Pattern.compile("^locations/[^/]+$");

            /**
             * Returns the search keywords used to find a business in search or maps. Each search keyword is
             * accompanied by impressions which are aggregated on a monthly basis. Example request: `GET https
             * ://businessprofileperformance.googleapis.com/v1/locations/12345/searchkeywords/impressions/mont
             * hly?monthly_range.start_month.year=2022_range.start_month.month=1_range.end_month.year=2022_ran
             * ge.end_month.month=3`
             *
             * Create a request for the method "monthly.list".
             *
             * This request holds the parameters needed by the the businessprofileperformance server.  After
             * setting any optional parameters, call the {@link List#execute()} method to invoke the remote
             * operation. <p> {@link
             * List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must be
             * called to initialize this instance immediately after invoking the constructor. </p>
             *
             * @param parent Required. The location for which the time series should be fetched. Format: locations/{location_id}
           *        where location_id is an unobfuscated listing id.
             * @since 1.13
             */
            protected List(java.lang.String parent) {
              super(BusinessProfilePerformance.this, "GET", REST_PATH, null, com.google.api.services.businessprofileperformance.v1.model.ListSearchKeywordImpressionsMonthlyResponse.class);
              this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
              if (!getSuppressPatternChecks()) {
                com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
                    "Parameter parent must conform to the pattern " +
                    "^locations/[^/]+$");
              }
            }

            @Override
            public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
              return super.executeUsingHead();
            }

            @Override
            public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
              return super.buildHttpRequestUsingHead();
            }

            @Override
            public List set$Xgafv(java.lang.String $Xgafv) {
              return (List) super.set$Xgafv($Xgafv);
            }

            @Override
            public List setAccessToken(java.lang.String accessToken) {
              return (List) super.setAccessToken(accessToken);
            }

            @Override
            public List setAlt(java.lang.String alt) {
              return (List) super.setAlt(alt);
            }

            @Override
            public List setCallback(java.lang.String callback) {
              return (List) super.setCallback(callback);
            }

            @Override
            public List setFields(java.lang.String fields) {
              return (List) super.setFields(fields);
            }

            @Override
            public List setKey(java.lang.String key) {
              return (List) super.setKey(key);
            }

            @Override
            public List setOauthToken(java.lang.String oauthToken) {
              return (List) super.setOauthToken(oauthToken);
            }

            @Override
            public List setPrettyPrint(java.lang.Boolean prettyPrint) {
              return (List) super.setPrettyPrint(prettyPrint);
            }

            @Override
            public List setQuotaUser(java.lang.String quotaUser) {
              return (List) super.setQuotaUser(quotaUser);
            }

            @Override
            public List setUploadType(java.lang.String uploadType) {
              return (List) super.setUploadType(uploadType);
            }

            @Override
            public List setUploadProtocol(java.lang.String uploadProtocol) {
              return (List) super.setUploadProtocol(uploadProtocol);
            }

            /**
             * Required. The location for which the time series should be fetched. Format:
             * locations/{location_id} where location_id is an unobfuscated listing id.
             */
            @com.google.api.client.util.Key
            private java.lang.String parent;

            /** Required. The location for which the time series should be fetched. Format: locations/{location_id}
           where location_id is an unobfuscated listing id.
             */
            public java.lang.String getParent() {
              return parent;
            }

            /**
             * Required. The location for which the time series should be fetched. Format:
             * locations/{location_id} where location_id is an unobfuscated listing id.
             */
            public List setParent(java.lang.String parent) {
              if (!getSuppressPatternChecks()) {
                com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
                    "Parameter parent must conform to the pattern " +
                    "^locations/[^/]+$");
              }
              this.parent = parent;
              return this;
            }

            /**
             * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to
             * specify a year by itself or a year and month where the day isn't significant.
             */
            @com.google.api.client.util.Key("monthlyRange.endMonth.day")
            private java.lang.Integer monthlyRangeEndMonthDay;

            /** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by
           itself or a year and month where the day isn't significant.
             */
            public java.lang.Integer getMonthlyRangeEndMonthDay() {
              return monthlyRangeEndMonthDay;
            }

            /**
             * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to
             * specify a year by itself or a year and month where the day isn't significant.
             */
            public List setMonthlyRangeEndMonthDay(java.lang.Integer monthlyRangeEndMonthDay) {
              this.monthlyRangeEndMonthDay = monthlyRangeEndMonthDay;
              return this;
            }

            /**
             * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and
             * day.
             */
            @com.google.api.client.util.Key("monthlyRange.endMonth.month")
            private java.lang.Integer monthlyRangeEndMonthMonth;

            /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
             */
            public java.lang.Integer getMonthlyRangeEndMonthMonth() {
              return monthlyRangeEndMonthMonth;
            }

            /**
             * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and
             * day.
             */
            public List setMonthlyRangeEndMonthMonth(java.lang.Integer monthlyRangeEndMonthMonth) {
              this.monthlyRangeEndMonthMonth = monthlyRangeEndMonthMonth;
              return this;
            }

            /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
            @com.google.api.client.util.Key("monthlyRange.endMonth.year")
            private java.lang.Integer monthlyRangeEndMonthYear;

            /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
             */
            public java.lang.Integer getMonthlyRangeEndMonthYear() {
              return monthlyRangeEndMonthYear;
            }

            /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
            public List setMonthlyRangeEndMonthYear(java.lang.Integer monthlyRangeEndMonthYear) {
              this.monthlyRangeEndMonthYear = monthlyRangeEndMonthYear;
              return this;
            }

            /**
             * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to
             * specify a year by itself or a year and month where the day isn't significant.
             */
            @com.google.api.client.util.Key("monthlyRange.startMonth.day")
            private java.lang.Integer monthlyRangeStartMonthDay;

            /** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by
           itself or a year and month where the day isn't significant.
             */
            public java.lang.Integer getMonthlyRangeStartMonthDay() {
              return monthlyRangeStartMonthDay;
            }

            /**
             * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to
             * specify a year by itself or a year and month where the day isn't significant.
             */
            public List setMonthlyRangeStartMonthDay(java.lang.Integer monthlyRangeStartMonthDay) {
              this.monthlyRangeStartMonthDay = monthlyRangeStartMonthDay;
              return this;
            }

            /**
             * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and
             * day.
             */
            @com.google.api.client.util.Key("monthlyRange.startMonth.month")
            private java.lang.Integer monthlyRangeStartMonthMonth;

            /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
             */
            public java.lang.Integer getMonthlyRangeStartMonthMonth() {
              return monthlyRangeStartMonthMonth;
            }

            /**
             * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and
             * day.
             */
            public List setMonthlyRangeStartMonthMonth(java.lang.Integer monthlyRangeStartMonthMonth) {
              this.monthlyRangeStartMonthMonth = monthlyRangeStartMonthMonth;
              return this;
            }

            /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
            @com.google.api.client.util.Key("monthlyRange.startMonth.year")
            private java.lang.Integer monthlyRangeStartMonthYear;

            /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
             */
            public java.lang.Integer getMonthlyRangeStartMonthYear() {
              return monthlyRangeStartMonthYear;
            }

            /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
            public List setMonthlyRangeStartMonthYear(java.lang.Integer monthlyRangeStartMonthYear) {
              this.monthlyRangeStartMonthYear = monthlyRangeStartMonthYear;
              return this;
            }

            /**
             * Optional. The number of results requested. The default page size is 100. Page size
             * can be set to a maximum of 100.
             */
            @com.google.api.client.util.Key
            private java.lang.Integer pageSize;

            /** Optional. The number of results requested. The default page size is 100. Page size can be set to a
           maximum of 100.
             */
            public java.lang.Integer getPageSize() {
              return pageSize;
            }

            /**
             * Optional. The number of results requested. The default page size is 100. Page size
             * can be set to a maximum of 100.
             */
            public List setPageSize(java.lang.Integer pageSize) {
              this.pageSize = pageSize;
              return this;
            }

            /** Optional. A token indicating the next paginated result to be returned. */
            @com.google.api.client.util.Key
            private java.lang.String pageToken;

            /** Optional. A token indicating the next paginated result to be returned.
             */
            public java.lang.String getPageToken() {
              return pageToken;
            }

            /** Optional. A token indicating the next paginated result to be returned. */
            public List setPageToken(java.lang.String pageToken) {
              this.pageToken = pageToken;
              return this;
            }

            @Override
            public List set(String parameterName, Object value) {
              return (List) super.set(parameterName, value);
            }
          }

        }
      }
    }
  }

  /**
   * Builder for {@link BusinessProfilePerformance}.
   *
   * <p>
   * Implementation is not thread-safe.
   * </p>
   *
   * @since 1.3.0
   */
  public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {

    private static String chooseEndpoint(com.google.api.client.http.HttpTransport transport) {
      // If the GOOGLE_API_USE_MTLS_ENDPOINT environment variable value is "always", use mTLS endpoint.
      // If the env variable is "auto", use mTLS endpoint if and only if the transport is mTLS.
      // Use the regular endpoint for all other cases.
      String useMtlsEndpoint = System.getenv("GOOGLE_API_USE_MTLS_ENDPOINT");
      useMtlsEndpoint = useMtlsEndpoint == null ? "auto" : useMtlsEndpoint;
      if ("always".equals(useMtlsEndpoint) || ("auto".equals(useMtlsEndpoint) && transport != null && transport.isMtls())) {
        return DEFAULT_MTLS_ROOT_URL;
      }
      return DEFAULT_ROOT_URL;
    }

    /**
     * Returns an instance of a new builder.
     *
     * @param transport HTTP transport, which should normally be:
     *        <ul>
     *        <li>Google App Engine:
     *        {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
     *        <li>Android: {@code newCompatibleTransport} from
     *        {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
     *        <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
     *        </li>
     *        </ul>
     * @param jsonFactory JSON factory, which may be:
     *        <ul>
     *        <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
     *        <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
     *        <li>Android Honeycomb or higher:
     *        {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
     *        </ul>
     * @param httpRequestInitializer HTTP request initializer or {@code null} for none
     * @since 1.7
     */
    public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
        com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
      super(
          transport,
          jsonFactory,
          Builder.chooseEndpoint(transport),
          DEFAULT_SERVICE_PATH,
          httpRequestInitializer,
          false);
      setBatchPath(DEFAULT_BATCH_PATH);
    }

    /** Builds a new instance of {@link BusinessProfilePerformance}. */
    @Override
    public BusinessProfilePerformance build() {
      return new BusinessProfilePerformance(this);
    }

    @Override
    public Builder setRootUrl(String rootUrl) {
      return (Builder) super.setRootUrl(rootUrl);
    }

    @Override
    public Builder setServicePath(String servicePath) {
      return (Builder) super.setServicePath(servicePath);
    }

    @Override
    public Builder setBatchPath(String batchPath) {
      return (Builder) super.setBatchPath(batchPath);
    }

    @Override
    public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
      return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
    }

    @Override
    public Builder setApplicationName(String applicationName) {
      return (Builder) super.setApplicationName(applicationName);
    }

    @Override
    public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
      return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
    }

    @Override
    public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
      return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
    }

    @Override
    public Builder setSuppressAllChecks(boolean suppressAllChecks) {
      return (Builder) super.setSuppressAllChecks(suppressAllChecks);
    }

    /**
     * Set the {@link BusinessProfilePerformanceRequestInitializer}.
     *
     * @since 1.12
     */
    public Builder setBusinessProfilePerformanceRequestInitializer(
        BusinessProfilePerformanceRequestInitializer businessprofileperformanceRequestInitializer) {
      return (Builder) super.setGoogleClientRequestInitializer(businessprofileperformanceRequestInitializer);
    }

    @Override
    public Builder setGoogleClientRequestInitializer(
        com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
      return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
    }
  }
}
