<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: temporal/api/rules/v1/message.proto

namespace Temporal\Api\Rules\V1;

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

/**
 * Generated from protobuf message <code>temporal.api.rules.v1.WorkflowRuleSpec</code>
 */
class WorkflowRuleSpec extends \Google\Protobuf\Internal\Message
{
    /**
     * The id of the new workflow rule. Must be unique within the namespace.
     * Can be set by the user, and can have business meaning.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     */
    protected $id = '';
    /**
     * Restricted Visibility query.
     * This query is used to filter workflows in this namespace to which this rule should apply.
     * It is applied to any running workflow each time a triggering event occurs, before the trigger predicate is evaluated.
     * The following workflow attributes are supported:
     * - WorkflowType
     * - WorkflowId
     * - StartTime
     * - ExecutionStatus
     *
     * Generated from protobuf field <code>string visibility_query = 3;</code>
     */
    protected $visibility_query = '';
    /**
     * WorkflowRuleAction to be taken when the rule is triggered and predicate is matched.
     *
     * Generated from protobuf field <code>repeated .temporal.api.rules.v1.WorkflowRuleAction actions = 4;</code>
     */
    private $actions;
    /**
     * Expiration time of the rule. After this time, the rule will be deleted.
     * Can be empty if the rule should never expire.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp expiration_time = 5;</code>
     */
    protected $expiration_time = null;
    protected $trigger;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $id
     *           The id of the new workflow rule. Must be unique within the namespace.
     *           Can be set by the user, and can have business meaning.
     *     @type \Temporal\Api\Rules\V1\WorkflowRuleSpec\ActivityStartingTrigger $activity_start
     *     @type string $visibility_query
     *           Restricted Visibility query.
     *           This query is used to filter workflows in this namespace to which this rule should apply.
     *           It is applied to any running workflow each time a triggering event occurs, before the trigger predicate is evaluated.
     *           The following workflow attributes are supported:
     *           - WorkflowType
     *           - WorkflowId
     *           - StartTime
     *           - ExecutionStatus
     *     @type \Temporal\Api\Rules\V1\WorkflowRuleAction[] $actions
     *           WorkflowRuleAction to be taken when the rule is triggered and predicate is matched.
     *     @type \Google\Protobuf\Timestamp $expiration_time
     *           Expiration time of the rule. After this time, the rule will be deleted.
     *           Can be empty if the rule should never expire.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Temporal\Api\Rules\V1\Message::initOnce();
        parent::__construct($data);
    }

    /**
     * The id of the new workflow rule. Must be unique within the namespace.
     * Can be set by the user, and can have business meaning.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     * @return string
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * The id of the new workflow rule. Must be unique within the namespace.
     * Can be set by the user, and can have business meaning.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkString($var, True);
        $this->id = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.temporal.api.rules.v1.WorkflowRuleSpec.ActivityStartingTrigger activity_start = 2;</code>
     * @return \Temporal\Api\Rules\V1\WorkflowRuleSpec\ActivityStartingTrigger|null
     */
    public function getActivityStart()
    {
        return $this->readOneof(2);
    }

    public function hasActivityStart()
    {
        return $this->hasOneof(2);
    }

    /**
     * Generated from protobuf field <code>.temporal.api.rules.v1.WorkflowRuleSpec.ActivityStartingTrigger activity_start = 2;</code>
     * @param \Temporal\Api\Rules\V1\WorkflowRuleSpec\ActivityStartingTrigger $var
     * @return $this
     */
    public function setActivityStart($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Rules\V1\WorkflowRuleSpec\ActivityStartingTrigger::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Restricted Visibility query.
     * This query is used to filter workflows in this namespace to which this rule should apply.
     * It is applied to any running workflow each time a triggering event occurs, before the trigger predicate is evaluated.
     * The following workflow attributes are supported:
     * - WorkflowType
     * - WorkflowId
     * - StartTime
     * - ExecutionStatus
     *
     * Generated from protobuf field <code>string visibility_query = 3;</code>
     * @return string
     */
    public function getVisibilityQuery()
    {
        return $this->visibility_query;
    }

    /**
     * Restricted Visibility query.
     * This query is used to filter workflows in this namespace to which this rule should apply.
     * It is applied to any running workflow each time a triggering event occurs, before the trigger predicate is evaluated.
     * The following workflow attributes are supported:
     * - WorkflowType
     * - WorkflowId
     * - StartTime
     * - ExecutionStatus
     *
     * Generated from protobuf field <code>string visibility_query = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setVisibilityQuery($var)
    {
        GPBUtil::checkString($var, True);
        $this->visibility_query = $var;

        return $this;
    }

    /**
     * WorkflowRuleAction to be taken when the rule is triggered and predicate is matched.
     *
     * Generated from protobuf field <code>repeated .temporal.api.rules.v1.WorkflowRuleAction actions = 4;</code>
     * @return RepeatedField<\Temporal\Api\Rules\V1\WorkflowRuleAction>
     */
    public function getActions()
    {
        return $this->actions;
    }

    /**
     * WorkflowRuleAction to be taken when the rule is triggered and predicate is matched.
     *
     * Generated from protobuf field <code>repeated .temporal.api.rules.v1.WorkflowRuleAction actions = 4;</code>
     * @param \Temporal\Api\Rules\V1\WorkflowRuleAction[] $var
     * @return $this
     */
    public function setActions($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Temporal\Api\Rules\V1\WorkflowRuleAction::class);
        $this->actions = $arr;

        return $this;
    }

    /**
     * Expiration time of the rule. After this time, the rule will be deleted.
     * Can be empty if the rule should never expire.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp expiration_time = 5;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getExpirationTime()
    {
        return $this->expiration_time;
    }

    public function hasExpirationTime()
    {
        return isset($this->expiration_time);
    }

    public function clearExpirationTime()
    {
        unset($this->expiration_time);
    }

    /**
     * Expiration time of the rule. After this time, the rule will be deleted.
     * Can be empty if the rule should never expire.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp expiration_time = 5;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setExpirationTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->expiration_time = $var;

        return $this;
    }

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

}

