<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: eventrules.proto

namespace OS\PB;

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

/**
 * Generated from protobuf message <code>OS.PB.EventRule</code>
 */
class EventRule extends \Google\Protobuf\Internal\Message
{
    /**
     * The device id which to send these actions. 
     *
     * Generated from protobuf field <code>uint64 DestinationDeviceId = 1;</code>
     */
    protected $DestinationDeviceId = 0;
    /**
     * If 0, then the actions are returned to the sender of the event. 
     * If any other id other than own device id, then the action messages are queued for a Destination Device.
     *
     * Generated from protobuf field <code>.OS.PB.EventMessage OnCondition = 5;</code>
     */
    protected $OnCondition = null;
    /**
     * if the field is 0 or not set, then it will accept any value in the generated event.
     * If field is set, then the event rule will only fire if the field value matches the field value in the generated event.
     *
     * Generated from protobuf field <code>repeated .OS.PB.EventMessage ExceptWhen = 10;</code>
     */
    private $ExceptWhen;
    /**
     * If true, only the first rule that meets the criteria has its actions performed
     *
     * Generated from protobuf field <code>bool BreakOnMatch = 13;</code>
     */
    protected $BreakOnMatch = false;
    /**
     * This executes a series of static actions when the event occurs.           
     *
     * Generated from protobuf field <code>repeated .OS.PB.ActionMessage DoActions = 15;</code>
     */
    private $DoActions;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $DestinationDeviceId
     *           The device id which to send these actions. 
     *     @type \OS\PB\EventMessage $OnCondition
     *           If 0, then the actions are returned to the sender of the event. 
     *           If any other id other than own device id, then the action messages are queued for a Destination Device.
     *     @type \OS\PB\EventMessage[] $ExceptWhen
     *           if the field is 0 or not set, then it will accept any value in the generated event.
     *           If field is set, then the event rule will only fire if the field value matches the field value in the generated event.
     *     @type bool $BreakOnMatch
     *           If true, only the first rule that meets the criteria has its actions performed
     *     @type \OS\PB\ActionMessage[] $DoActions
     *           This executes a series of static actions when the event occurs.           
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Eventrules::initOnce();
        parent::__construct($data);
    }

    /**
     * The device id which to send these actions. 
     *
     * Generated from protobuf field <code>uint64 DestinationDeviceId = 1;</code>
     * @return int|string
     */
    public function getDestinationDeviceId()
    {
        return $this->DestinationDeviceId;
    }

    /**
     * The device id which to send these actions. 
     *
     * Generated from protobuf field <code>uint64 DestinationDeviceId = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setDestinationDeviceId($var)
    {
        GPBUtil::checkUint64($var);
        $this->DestinationDeviceId = $var;

        return $this;
    }

    /**
     * If 0, then the actions are returned to the sender of the event. 
     * If any other id other than own device id, then the action messages are queued for a Destination Device.
     *
     * Generated from protobuf field <code>.OS.PB.EventMessage OnCondition = 5;</code>
     * @return \OS\PB\EventMessage|null
     */
    public function getOnCondition()
    {
        return $this->OnCondition;
    }

    public function hasOnCondition()
    {
        return isset($this->OnCondition);
    }

    public function clearOnCondition()
    {
        unset($this->OnCondition);
    }

    /**
     * If 0, then the actions are returned to the sender of the event. 
     * If any other id other than own device id, then the action messages are queued for a Destination Device.
     *
     * Generated from protobuf field <code>.OS.PB.EventMessage OnCondition = 5;</code>
     * @param \OS\PB\EventMessage $var
     * @return $this
     */
    public function setOnCondition($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\EventMessage::class);
        $this->OnCondition = $var;

        return $this;
    }

    /**
     * if the field is 0 or not set, then it will accept any value in the generated event.
     * If field is set, then the event rule will only fire if the field value matches the field value in the generated event.
     *
     * Generated from protobuf field <code>repeated .OS.PB.EventMessage ExceptWhen = 10;</code>
     * @return RepeatedField<\OS\PB\EventMessage>
     */
    public function getExceptWhen()
    {
        return $this->ExceptWhen;
    }

    /**
     * if the field is 0 or not set, then it will accept any value in the generated event.
     * If field is set, then the event rule will only fire if the field value matches the field value in the generated event.
     *
     * Generated from protobuf field <code>repeated .OS.PB.EventMessage ExceptWhen = 10;</code>
     * @param \OS\PB\EventMessage[] $var
     * @return $this
     */
    public function setExceptWhen($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \OS\PB\EventMessage::class);
        $this->ExceptWhen = $arr;

        return $this;
    }

    /**
     * If true, only the first rule that meets the criteria has its actions performed
     *
     * Generated from protobuf field <code>bool BreakOnMatch = 13;</code>
     * @return bool
     */
    public function getBreakOnMatch()
    {
        return $this->BreakOnMatch;
    }

    /**
     * If true, only the first rule that meets the criteria has its actions performed
     *
     * Generated from protobuf field <code>bool BreakOnMatch = 13;</code>
     * @param bool $var
     * @return $this
     */
    public function setBreakOnMatch($var)
    {
        GPBUtil::checkBool($var);
        $this->BreakOnMatch = $var;

        return $this;
    }

    /**
     * This executes a series of static actions when the event occurs.           
     *
     * Generated from protobuf field <code>repeated .OS.PB.ActionMessage DoActions = 15;</code>
     * @return RepeatedField<\OS\PB\ActionMessage>
     */
    public function getDoActions()
    {
        return $this->DoActions;
    }

    /**
     * This executes a series of static actions when the event occurs.           
     *
     * Generated from protobuf field <code>repeated .OS.PB.ActionMessage DoActions = 15;</code>
     * @param \OS\PB\ActionMessage[] $var
     * @return $this
     */
    public function setDoActions($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \OS\PB\ActionMessage::class);
        $this->DoActions = $arr;

        return $this;
    }

}

