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

namespace Google\Cloud\BackupDR\V1;

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

/**
 * Specifies the reservations that this instance can consume from.
 *
 * Generated from protobuf message <code>google.cloud.backupdr.v1.AllocationAffinity</code>
 */
class AllocationAffinity extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. Specifies the type of reservation from which this instance can
     * consume
     *
     * Generated from protobuf field <code>optional .google.cloud.backupdr.v1.AllocationAffinity.Type consume_allocation_type = 1 [json_name = "consumeReservationType", (.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $consume_allocation_type = null;
    /**
     * Optional. Corresponds to the label key of a reservation resource.
     *
     * Generated from protobuf field <code>optional string key = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $key = null;
    /**
     * Optional. Corresponds to the label values of a reservation resource.
     *
     * Generated from protobuf field <code>repeated string values = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $values;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $consume_allocation_type
     *           Optional. Specifies the type of reservation from which this instance can
     *           consume
     *     @type string $key
     *           Optional. Corresponds to the label key of a reservation resource.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $values
     *           Optional. Corresponds to the label values of a reservation resource.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Backupdr\V1\BackupvaultGce::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. Specifies the type of reservation from which this instance can
     * consume
     *
     * Generated from protobuf field <code>optional .google.cloud.backupdr.v1.AllocationAffinity.Type consume_allocation_type = 1 [json_name = "consumeReservationType", (.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getConsumeAllocationType()
    {
        return isset($this->consume_allocation_type) ? $this->consume_allocation_type : 0;
    }

    public function hasConsumeAllocationType()
    {
        return isset($this->consume_allocation_type);
    }

    public function clearConsumeAllocationType()
    {
        unset($this->consume_allocation_type);
    }

    /**
     * Optional. Specifies the type of reservation from which this instance can
     * consume
     *
     * Generated from protobuf field <code>optional .google.cloud.backupdr.v1.AllocationAffinity.Type consume_allocation_type = 1 [json_name = "consumeReservationType", (.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setConsumeAllocationType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BackupDR\V1\AllocationAffinity\Type::class);
        $this->consume_allocation_type = $var;

        return $this;
    }

    /**
     * Optional. Corresponds to the label key of a reservation resource.
     *
     * Generated from protobuf field <code>optional string key = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getKey()
    {
        return isset($this->key) ? $this->key : '';
    }

    public function hasKey()
    {
        return isset($this->key);
    }

    public function clearKey()
    {
        unset($this->key);
    }

    /**
     * Optional. Corresponds to the label key of a reservation resource.
     *
     * Generated from protobuf field <code>optional string key = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->key = $var;

        return $this;
    }

    /**
     * Optional. Corresponds to the label values of a reservation resource.
     *
     * Generated from protobuf field <code>repeated string values = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getValues()
    {
        return $this->values;
    }

    /**
     * Optional. Corresponds to the label values of a reservation resource.
     *
     * Generated from protobuf field <code>repeated string values = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->values = $arr;

        return $this;
    }

}

