<?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;

/**
 * The automated backup config for an instance.
 *
 * Generated from protobuf message <code>google.cloud.memorystore.v1.AutomatedBackupConfig</code>
 */
class AutomatedBackupConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The automated backup mode. If the mode is disabled, the other
     * fields will be ignored.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.AutomatedBackupConfig.AutomatedBackupMode automated_backup_mode = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $automated_backup_mode = 0;
    /**
     * Optional. How long to keep automated backups before the backups are
     * deleted. The value should be between 1 day and 365 days. If not specified,
     * the default value is 35 days.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration retention = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $retention = null;
    protected $schedule;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Memorystore\V1\AutomatedBackupConfig\FixedFrequencySchedule $fixed_frequency_schedule
     *           Optional. Trigger automated backups at a fixed frequency.
     *     @type int $automated_backup_mode
     *           Optional. The automated backup mode. If the mode is disabled, the other
     *           fields will be ignored.
     *     @type \Google\Protobuf\Duration $retention
     *           Optional. How long to keep automated backups before the backups are
     *           deleted. The value should be between 1 day and 365 days. If not specified,
     *           the default value is 35 days.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Memorystore\V1\Memorystore::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. Trigger automated backups at a fixed frequency.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.AutomatedBackupConfig.FixedFrequencySchedule fixed_frequency_schedule = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Memorystore\V1\AutomatedBackupConfig\FixedFrequencySchedule|null
     */
    public function getFixedFrequencySchedule()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Optional. Trigger automated backups at a fixed frequency.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.AutomatedBackupConfig.FixedFrequencySchedule fixed_frequency_schedule = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Memorystore\V1\AutomatedBackupConfig\FixedFrequencySchedule $var
     * @return $this
     */
    public function setFixedFrequencySchedule($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Memorystore\V1\AutomatedBackupConfig\FixedFrequencySchedule::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Optional. The automated backup mode. If the mode is disabled, the other
     * fields will be ignored.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.AutomatedBackupConfig.AutomatedBackupMode automated_backup_mode = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getAutomatedBackupMode()
    {
        return $this->automated_backup_mode;
    }

    /**
     * Optional. The automated backup mode. If the mode is disabled, the other
     * fields will be ignored.
     *
     * Generated from protobuf field <code>.google.cloud.memorystore.v1.AutomatedBackupConfig.AutomatedBackupMode automated_backup_mode = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setAutomatedBackupMode($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Memorystore\V1\AutomatedBackupConfig\AutomatedBackupMode::class);
        $this->automated_backup_mode = $var;

        return $this;
    }

    /**
     * Optional. How long to keep automated backups before the backups are
     * deleted. The value should be between 1 day and 365 days. If not specified,
     * the default value is 35 days.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration retention = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getRetention()
    {
        return $this->retention;
    }

    public function hasRetention()
    {
        return isset($this->retention);
    }

    public function clearRetention()
    {
        unset($this->retention);
    }

    /**
     * Optional. How long to keep automated backups before the backups are
     * deleted. The value should be between 1 day and 365 days. If not specified,
     * the default value is 35 days.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration retention = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setRetention($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->retention = $var;

        return $this;
    }

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

}

