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

namespace Google\Cloud\NetworkServices\V1;

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

/**
 * A definition of a matcher that selects endpoints to which the policies
 * should be applied.
 *
 * Generated from protobuf message <code>google.cloud.networkservices.v1.EndpointMatcher</code>
 */
class EndpointMatcher extends \Google\Protobuf\Internal\Message
{
    protected $matcher_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher $metadata_label_matcher
     *           The matcher is based on node metadata presented by xDS clients.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Networkservices\V1\Common::initOnce();
        parent::__construct($data);
    }

    /**
     * The matcher is based on node metadata presented by xDS clients.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher metadata_label_matcher = 1;</code>
     * @return \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher|null
     */
    public function getMetadataLabelMatcher()
    {
        return $this->readOneof(1);
    }

    public function hasMetadataLabelMatcher()
    {
        return $this->hasOneof(1);
    }

    /**
     * The matcher is based on node metadata presented by xDS clients.
     *
     * Generated from protobuf field <code>.google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher metadata_label_matcher = 1;</code>
     * @param \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher $var
     * @return $this
     */
    public function setMetadataLabelMatcher($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\NetworkServices\V1\EndpointMatcher\MetadataLabelMatcher::class);
        $this->writeOneof(1, $var);

        return $this;
    }

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

}

