<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/analytics/admin/v1alpha/event_create_and_edit.proto

namespace Google\Analytics\Admin\V1alpha;

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

/**
 * Defines a condition for when an Event Edit or Event Creation rule applies to
 * an event.
 *
 * Generated from protobuf message <code>google.analytics.admin.v1alpha.MatchingCondition</code>
 */
class MatchingCondition extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The name of the field that is compared against for the condition.
     * If 'event_name' is specified this condition will apply to the name of the
     * event.  Otherwise the condition will apply to a parameter with the
     * specified name.
     * This value cannot contain spaces.
     *
     * Generated from protobuf field <code>string field = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $field = '';
    /**
     * Required. The type of comparison to be applied to the value.
     *
     * Generated from protobuf field <code>.google.analytics.admin.v1alpha.MatchingCondition.ComparisonType comparison_type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $comparison_type = 0;
    /**
     * Required. The value being compared against for this condition.  The runtime
     * implementation may perform type coercion of this value to evaluate this
     * condition based on the type of the parameter value.
     *
     * Generated from protobuf field <code>string value = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $value = '';
    /**
     * Whether or not the result of the comparison should be negated. For example,
     * if `negated` is true, then 'equals' comparisons would function as 'not
     * equals'.
     *
     * Generated from protobuf field <code>bool negated = 4;</code>
     */
    private $negated = false;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $field
     *           Required. The name of the field that is compared against for the condition.
     *           If 'event_name' is specified this condition will apply to the name of the
     *           event.  Otherwise the condition will apply to a parameter with the
     *           specified name.
     *           This value cannot contain spaces.
     *     @type int $comparison_type
     *           Required. The type of comparison to be applied to the value.
     *     @type string $value
     *           Required. The value being compared against for this condition.  The runtime
     *           implementation may perform type coercion of this value to evaluate this
     *           condition based on the type of the parameter value.
     *     @type bool $negated
     *           Whether or not the result of the comparison should be negated. For example,
     *           if `negated` is true, then 'equals' comparisons would function as 'not
     *           equals'.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Analytics\Admin\V1Alpha\EventCreateAndEdit::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The name of the field that is compared against for the condition.
     * If 'event_name' is specified this condition will apply to the name of the
     * event.  Otherwise the condition will apply to a parameter with the
     * specified name.
     * This value cannot contain spaces.
     *
     * Generated from protobuf field <code>string field = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getField()
    {
        return $this->field;
    }

    /**
     * Required. The name of the field that is compared against for the condition.
     * If 'event_name' is specified this condition will apply to the name of the
     * event.  Otherwise the condition will apply to a parameter with the
     * specified name.
     * This value cannot contain spaces.
     *
     * Generated from protobuf field <code>string field = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setField($var)
    {
        GPBUtil::checkString($var, True);
        $this->field = $var;

        return $this;
    }

    /**
     * Required. The type of comparison to be applied to the value.
     *
     * Generated from protobuf field <code>.google.analytics.admin.v1alpha.MatchingCondition.ComparisonType comparison_type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getComparisonType()
    {
        return $this->comparison_type;
    }

    /**
     * Required. The type of comparison to be applied to the value.
     *
     * Generated from protobuf field <code>.google.analytics.admin.v1alpha.MatchingCondition.ComparisonType comparison_type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setComparisonType($var)
    {
        GPBUtil::checkEnum($var, \Google\Analytics\Admin\V1alpha\MatchingCondition\ComparisonType::class);
        $this->comparison_type = $var;

        return $this;
    }

    /**
     * Required. The value being compared against for this condition.  The runtime
     * implementation may perform type coercion of this value to evaluate this
     * condition based on the type of the parameter value.
     *
     * Generated from protobuf field <code>string value = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * Required. The value being compared against for this condition.  The runtime
     * implementation may perform type coercion of this value to evaluate this
     * condition based on the type of the parameter value.
     *
     * Generated from protobuf field <code>string value = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setValue($var)
    {
        GPBUtil::checkString($var, True);
        $this->value = $var;

        return $this;
    }

    /**
     * Whether or not the result of the comparison should be negated. For example,
     * if `negated` is true, then 'equals' comparisons would function as 'not
     * equals'.
     *
     * Generated from protobuf field <code>bool negated = 4;</code>
     * @return bool
     */
    public function getNegated()
    {
        return $this->negated;
    }

    /**
     * Whether or not the result of the comparison should be negated. For example,
     * if `negated` is true, then 'equals' comparisons would function as 'not
     * equals'.
     *
     * Generated from protobuf field <code>bool negated = 4;</code>
     * @param bool $var
     * @return $this
     */
    public function setNegated($var)
    {
        GPBUtil::checkBool($var);
        $this->negated = $var;

        return $this;
    }

}

