<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: apache/rocketmq/v2/definition.proto

namespace Apache\Rocketmq\V2;

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

/**
 * Generated from protobuf message <code>apache.rocketmq.v2.RetryPolicy</code>
 */
class RetryPolicy extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>int32 max_attempts = 1;</code>
     */
    protected $max_attempts = 0;
    protected $strategy;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $max_attempts
     *     @type \Apache\Rocketmq\V2\ExponentialBackoff $exponential_backoff
     *     @type \Apache\Rocketmq\V2\CustomizedBackoff $customized_backoff
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Apache\Rocketmq\V2\Definition::initOnce();
        parent::__construct($data);
    }

    /**
     * Generated from protobuf field <code>int32 max_attempts = 1;</code>
     * @return int
     */
    public function getMaxAttempts()
    {
        return $this->max_attempts;
    }

    /**
     * Generated from protobuf field <code>int32 max_attempts = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setMaxAttempts($var)
    {
        GPBUtil::checkInt32($var);
        $this->max_attempts = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.apache.rocketmq.v2.ExponentialBackoff exponential_backoff = 2;</code>
     * @return \Apache\Rocketmq\V2\ExponentialBackoff|null
     */
    public function getExponentialBackoff()
    {
        return $this->readOneof(2);
    }

    public function hasExponentialBackoff()
    {
        return $this->hasOneof(2);
    }

    /**
     * Generated from protobuf field <code>.apache.rocketmq.v2.ExponentialBackoff exponential_backoff = 2;</code>
     * @param \Apache\Rocketmq\V2\ExponentialBackoff $var
     * @return $this
     */
    public function setExponentialBackoff($var)
    {
        GPBUtil::checkMessage($var, \Apache\Rocketmq\V2\ExponentialBackoff::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.apache.rocketmq.v2.CustomizedBackoff customized_backoff = 3;</code>
     * @return \Apache\Rocketmq\V2\CustomizedBackoff|null
     */
    public function getCustomizedBackoff()
    {
        return $this->readOneof(3);
    }

    public function hasCustomizedBackoff()
    {
        return $this->hasOneof(3);
    }

    /**
     * Generated from protobuf field <code>.apache.rocketmq.v2.CustomizedBackoff customized_backoff = 3;</code>
     * @param \Apache\Rocketmq\V2\CustomizedBackoff $var
     * @return $this
     */
    public function setCustomizedBackoff($var)
    {
        GPBUtil::checkMessage($var, \Apache\Rocketmq\V2\CustomizedBackoff::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getStrategy()
    {
        return $this->whichOneof("strategy");
    }

}

