<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/redis/cluster/v1/cloud_redis_cluster.proto

namespace Google\Cloud\Redis\Cluster\V1;

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

/**
 * Configuration of the persistence functionality.
 *
 * Generated from protobuf message <code>google.cloud.redis.cluster.v1.ClusterPersistenceConfig</code>
 */
class ClusterPersistenceConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The mode of persistence.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode mode = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $mode = 0;
    /**
     * Optional. RDB configuration. This field will be ignored if mode is not RDB.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $rdb_config = null;
    /**
     * Optional. AOF configuration. This field will be ignored if mode is not AOF.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $aof_config = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $mode
     *           Optional. The mode of persistence.
     *     @type \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig $rdb_config
     *           Optional. RDB configuration. This field will be ignored if mode is not RDB.
     *     @type \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig $aof_config
     *           Optional. AOF configuration. This field will be ignored if mode is not AOF.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Redis\Cluster\V1\CloudRedisCluster::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. The mode of persistence.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode mode = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getMode()
    {
        return $this->mode;
    }

    /**
     * Optional. The mode of persistence.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.PersistenceMode mode = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setMode($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\PersistenceMode::class);
        $this->mode = $var;

        return $this;
    }

    /**
     * Optional. RDB configuration. This field will be ignored if mode is not RDB.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig|null
     */
    public function getRdbConfig()
    {
        return $this->rdb_config;
    }

    public function hasRdbConfig()
    {
        return isset($this->rdb_config);
    }

    public function clearRdbConfig()
    {
        unset($this->rdb_config);
    }

    /**
     * Optional. RDB configuration. This field will be ignored if mode is not RDB.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig $var
     * @return $this
     */
    public function setRdbConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\RDBConfig::class);
        $this->rdb_config = $var;

        return $this;
    }

    /**
     * Optional. AOF configuration. This field will be ignored if mode is not AOF.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig|null
     */
    public function getAofConfig()
    {
        return $this->aof_config;
    }

    public function hasAofConfig()
    {
        return isset($this->aof_config);
    }

    public function clearAofConfig()
    {
        unset($this->aof_config);
    }

    /**
     * Optional. AOF configuration. This field will be ignored if mode is not AOF.
     *
     * Generated from protobuf field <code>.google.cloud.redis.cluster.v1.ClusterPersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig $var
     * @return $this
     */
    public function setAofConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Redis\Cluster\V1\ClusterPersistenceConfig\AOFConfig::class);
        $this->aof_config = $var;

        return $this;
    }

}

