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

namespace Google\Cloud\Memorystore\V1;

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

/**
 * Represents persistence configuration for a instance.
 *
 * Generated from protobuf message <code>google.cloud.memorystore.v1.PersistenceConfig</code>
 */
class PersistenceConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. Current persistence mode.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.PersistenceConfig.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.memorystore.v1.PersistenceConfig.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.memorystore.v1.PersistenceConfig.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. Current persistence mode.
     *     @type \Google\Cloud\Memorystore\V1\PersistenceConfig\RDBConfig $rdb_config
     *           Optional. RDB configuration. This field will be ignored if mode is not RDB.
     *     @type \Google\Cloud\Memorystore\V1\PersistenceConfig\AOFConfig $aof_config
     *           Optional. AOF configuration. This field will be ignored if mode is not AOF.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Memorystore\V1\Memorystore::initOnce();
        parent::__construct($data);
    }

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

    /**
     * Optional. Current persistence mode.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.PersistenceConfig.PersistenceMode mode = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setMode($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Memorystore\V1\PersistenceConfig\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.memorystore.v1.PersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Memorystore\V1\PersistenceConfig\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.memorystore.v1.PersistenceConfig.RDBConfig rdb_config = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Memorystore\V1\PersistenceConfig\RDBConfig $var
     * @return $this
     */
    public function setRdbConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Memorystore\V1\PersistenceConfig\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.memorystore.v1.PersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Memorystore\V1\PersistenceConfig\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.memorystore.v1.PersistenceConfig.AOFConfig aof_config = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Memorystore\V1\PersistenceConfig\AOFConfig $var
     * @return $this
     */
    public function setAofConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Memorystore\V1\PersistenceConfig\AOFConfig::class);
        $this->aof_config = $var;

        return $this;
    }

}

