/*
 * Copyright 2019 Google Inc.
 *
 * 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.
 */

package com.google.template.soy.data;

import com.google.auto.value.AutoValue;
import com.google.common.reflect.TypeToken;

/**
 * A representation of a parameter to a Soy template.
 *
 * @see SoyTemplate
 */
@AutoValue
public abstract class SoyTemplateParam<T> {
  /** Creates a standard optional or required param with the given name. */
  public static <T> SoyTemplateParam<T> standard(String name, boolean required, TypeToken<T> type) {
    return new AutoValue_SoyTemplateParam<>(
        name, required, /* indirect= */ false, /* injected= */ false, type);
  }

  /** Creates an indirect param with the given name. Indirect params are always optional. */
  public static <T> SoyTemplateParam<T> indirect(String name, boolean required, TypeToken<T> type) {
    return new AutoValue_SoyTemplateParam<>(
        name, required, /* indirect= */ true, /* injected= */ false, type);
  }

  /** Creates an injected param with the given name. */
  public static <T> SoyTemplateParam<T> injected(String name, boolean required, TypeToken<T> type) {
    return new AutoValue_SoyTemplateParam<>(
        name, required, /* indirect= */ false, /* injected= */ true, type);
  }

  public abstract String getName();

  abstract boolean isRequired();

  abstract boolean isIndirect();

  abstract boolean isInjected();

  public abstract TypeToken<T> getType();

  boolean isRequiredAndNotIndirect() {
    return isRequired() && !isIndirect();
  }
}

@@ -1803,75 +1803,662 @@
 %0A%0A  
-abstract boolean isRequired();%0A%0A  abstract boolean isIndirect();%0A%0A 
+/**%0A   * Returns whether the parameter is declared as required. All required, non-indirect parameters%0A   * must be set for %7B@link SoyTemplate.Builder#build%7D to succeed.%0A   *%0A   * %3Cp%3EIf a parameter is indirect then %7B@link #isRequired%7D may return %60true%60. But missing indirect%0A   * parameters never cause %7B@link SoyTemplate.Builder#build%7D to fail.%0A   */%0A  public abstract boolean isRequired();%0A%0A  /**%0A   * Returns whether the parameter is indirectly included from another template via a %60%7Bcall%0A   * data=%22all%22%7D%60.%0A   */%0A  public abstract boolean isIndirect();%0A%0A  /** Returns whether the parameter is an injected parameter declared with %60@inject%60. */%0A  public
  abs

Make public/indirect/injected properties of SoyTemplateParam public for parity with SoyTemplateInfo API.