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

namespace Google\Cloud\BackupDR\V1\Scheduling;

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

/**
 * Node Affinity: the configuration of desired nodes onto which this Instance
 * could be scheduled.
 *
 * Generated from protobuf message <code>google.cloud.backupdr.v1.Scheduling.NodeAffinity</code>
 */
class NodeAffinity extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. Corresponds to the label key of Node resource.
     *
     * Generated from protobuf field <code>optional string key = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $key = null;
    /**
     * Optional. Defines the operation of node selection.
     *
     * Generated from protobuf field <code>optional .google.cloud.backupdr.v1.Scheduling.NodeAffinity.Operator operator = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $operator = null;
    /**
     * Optional. Corresponds to the label values of Node 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 string $key
     *           Optional. Corresponds to the label key of Node resource.
     *     @type int $operator
     *           Optional. Defines the operation of node selection.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $values
     *           Optional. Corresponds to the label values of Node resource.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Backupdr\V1\BackupvaultGce::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. Corresponds to the label key of Node resource.
     *
     * Generated from protobuf field <code>optional string key = 1 [(.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 Node resource.
     *
     * Generated from protobuf field <code>optional string key = 1 [(.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. Defines the operation of node selection.
     *
     * Generated from protobuf field <code>optional .google.cloud.backupdr.v1.Scheduling.NodeAffinity.Operator operator = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getOperator()
    {
        return isset($this->operator) ? $this->operator : 0;
    }

    public function hasOperator()
    {
        return isset($this->operator);
    }

    public function clearOperator()
    {
        unset($this->operator);
    }

    /**
     * Optional. Defines the operation of node selection.
     *
     * Generated from protobuf field <code>optional .google.cloud.backupdr.v1.Scheduling.NodeAffinity.Operator operator = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setOperator($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BackupDR\V1\Scheduling\NodeAffinity\Operator::class);
        $this->operator = $var;

        return $this;
    }

    /**
     * Optional. Corresponds to the label values of Node 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 Node 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;
    }

}


