<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/merchant/products/v1/products_common.proto

namespace Google\Shopping\Merchant\Products\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * A message that represents installment.
 *
 * Generated from protobuf message <code>google.shopping.merchant.products.v1.ProductInstallment</code>
 */
class ProductInstallment extends \Google\Protobuf\Internal\Message
{
    /**
     * The number of installments the buyer has to pay.
     *
     * Generated from protobuf field <code>int64 months = 1;</code>
     */
    protected $months = 0;
    /**
     * The amount the buyer has to pay per month.
     *
     * Generated from protobuf field <code>.google.shopping.type.Price amount = 2;</code>
     */
    protected $amount = null;
    /**
     * The up-front down payment amount the buyer has to pay.
     *
     * Generated from protobuf field <code>optional .google.shopping.type.Price downpayment = 3;</code>
     */
    protected $downpayment = null;
    /**
     * Type of installment payments.
     *
     * Generated from protobuf field <code>optional .google.shopping.merchant.products.v1.CreditType credit_type = 4;</code>
     */
    protected $credit_type = null;
    /**
     * Optional. Annual percentage rate for `credit_type` finance
     *
     * Generated from protobuf field <code>optional double annual_percentage_rate = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $annual_percentage_rate = null;
    /**
     * Optional. Total amount the buyer has to pay, including interest.
     *
     * Generated from protobuf field <code>optional .google.shopping.type.Price total_amount = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $total_amount = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $months
     *           The number of installments the buyer has to pay.
     *     @type \Google\Shopping\Type\Price $amount
     *           The amount the buyer has to pay per month.
     *     @type \Google\Shopping\Type\Price $downpayment
     *           The up-front down payment amount the buyer has to pay.
     *     @type int $credit_type
     *           Type of installment payments.
     *     @type float $annual_percentage_rate
     *           Optional. Annual percentage rate for `credit_type` finance
     *     @type \Google\Shopping\Type\Price $total_amount
     *           Optional. Total amount the buyer has to pay, including interest.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Shopping\Merchant\Products\V1\ProductsCommon::initOnce();
        parent::__construct($data);
    }

    /**
     * The number of installments the buyer has to pay.
     *
     * Generated from protobuf field <code>int64 months = 1;</code>
     * @return int|string
     */
    public function getMonths()
    {
        return $this->months;
    }

    /**
     * The number of installments the buyer has to pay.
     *
     * Generated from protobuf field <code>int64 months = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setMonths($var)
    {
        GPBUtil::checkInt64($var);
        $this->months = $var;

        return $this;
    }

    /**
     * The amount the buyer has to pay per month.
     *
     * Generated from protobuf field <code>.google.shopping.type.Price amount = 2;</code>
     * @return \Google\Shopping\Type\Price|null
     */
    public function getAmount()
    {
        return $this->amount;
    }

    public function hasAmount()
    {
        return isset($this->amount);
    }

    public function clearAmount()
    {
        unset($this->amount);
    }

    /**
     * The amount the buyer has to pay per month.
     *
     * Generated from protobuf field <code>.google.shopping.type.Price amount = 2;</code>
     * @param \Google\Shopping\Type\Price $var
     * @return $this
     */
    public function setAmount($var)
    {
        GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class);
        $this->amount = $var;

        return $this;
    }

    /**
     * The up-front down payment amount the buyer has to pay.
     *
     * Generated from protobuf field <code>optional .google.shopping.type.Price downpayment = 3;</code>
     * @return \Google\Shopping\Type\Price|null
     */
    public function getDownpayment()
    {
        return $this->downpayment;
    }

    public function hasDownpayment()
    {
        return isset($this->downpayment);
    }

    public function clearDownpayment()
    {
        unset($this->downpayment);
    }

    /**
     * The up-front down payment amount the buyer has to pay.
     *
     * Generated from protobuf field <code>optional .google.shopping.type.Price downpayment = 3;</code>
     * @param \Google\Shopping\Type\Price $var
     * @return $this
     */
    public function setDownpayment($var)
    {
        GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class);
        $this->downpayment = $var;

        return $this;
    }

    /**
     * Type of installment payments.
     *
     * Generated from protobuf field <code>optional .google.shopping.merchant.products.v1.CreditType credit_type = 4;</code>
     * @return int
     */
    public function getCreditType()
    {
        return isset($this->credit_type) ? $this->credit_type : 0;
    }

    public function hasCreditType()
    {
        return isset($this->credit_type);
    }

    public function clearCreditType()
    {
        unset($this->credit_type);
    }

    /**
     * Type of installment payments.
     *
     * Generated from protobuf field <code>optional .google.shopping.merchant.products.v1.CreditType credit_type = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setCreditType($var)
    {
        GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Products\V1\CreditType::class);
        $this->credit_type = $var;

        return $this;
    }

    /**
     * Optional. Annual percentage rate for `credit_type` finance
     *
     * Generated from protobuf field <code>optional double annual_percentage_rate = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getAnnualPercentageRate()
    {
        return isset($this->annual_percentage_rate) ? $this->annual_percentage_rate : 0.0;
    }

    public function hasAnnualPercentageRate()
    {
        return isset($this->annual_percentage_rate);
    }

    public function clearAnnualPercentageRate()
    {
        unset($this->annual_percentage_rate);
    }

    /**
     * Optional. Annual percentage rate for `credit_type` finance
     *
     * Generated from protobuf field <code>optional double annual_percentage_rate = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setAnnualPercentageRate($var)
    {
        GPBUtil::checkDouble($var);
        $this->annual_percentage_rate = $var;

        return $this;
    }

    /**
     * Optional. Total amount the buyer has to pay, including interest.
     *
     * Generated from protobuf field <code>optional .google.shopping.type.Price total_amount = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Shopping\Type\Price|null
     */
    public function getTotalAmount()
    {
        return $this->total_amount;
    }

    public function hasTotalAmount()
    {
        return isset($this->total_amount);
    }

    public function clearTotalAmount()
    {
        unset($this->total_amount);
    }

    /**
     * Optional. Total amount the buyer has to pay, including interest.
     *
     * Generated from protobuf field <code>optional .google.shopping.type.Price total_amount = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Shopping\Type\Price $var
     * @return $this
     */
    public function setTotalAmount($var)
    {
        GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class);
        $this->total_amount = $var;

        return $this;
    }

}

