<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/workflows/executions/v1beta/executions.proto

namespace Google\Cloud\Workflows\Executions\V1beta;

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

/**
 * A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow].
 *
 * Generated from protobuf message <code>google.cloud.workflows.executions.v1beta.Execution</code>
 */
class Execution extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The resource name of the execution.
     * Format:
     * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $name = '';
    /**
     * Output only. Marks the beginning of execution.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $start_time = null;
    /**
     * Output only. Marks the end of execution, successful or not.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $end_time = null;
    /**
     * Output only. Current state of the execution.
     *
     * Generated from protobuf field <code>.google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $state = 0;
    /**
     * Input parameters of the execution represented as a JSON string.
     * The size limit is 32KB.
     *
     * Generated from protobuf field <code>string argument = 5;</code>
     */
    private $argument = '';
    /**
     * Output only. Output of the execution represented as a JSON string. The
     * value can only be present if the execution's state is `SUCCEEDED`.
     *
     * Generated from protobuf field <code>string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $result = '';
    /**
     * Output only. The error which caused the execution to finish prematurely.
     * The value is only present if the execution's state is `FAILED`
     * or `CANCELLED`.
     *
     * Generated from protobuf field <code>.google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $error = null;
    /**
     * Output only. Revision of the workflow this execution is using.
     *
     * Generated from protobuf field <code>string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $workflow_revision_id = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Output only. The resource name of the execution.
     *           Format:
     *           projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
     *     @type \Google\Protobuf\Timestamp $start_time
     *           Output only. Marks the beginning of execution.
     *     @type \Google\Protobuf\Timestamp $end_time
     *           Output only. Marks the end of execution, successful or not.
     *     @type int $state
     *           Output only. Current state of the execution.
     *     @type string $argument
     *           Input parameters of the execution represented as a JSON string.
     *           The size limit is 32KB.
     *     @type string $result
     *           Output only. Output of the execution represented as a JSON string. The
     *           value can only be present if the execution's state is `SUCCEEDED`.
     *     @type \Google\Cloud\Workflows\Executions\V1beta\Execution\Error $error
     *           Output only. The error which caused the execution to finish prematurely.
     *           The value is only present if the execution's state is `FAILED`
     *           or `CANCELLED`.
     *     @type string $workflow_revision_id
     *           Output only. Revision of the workflow this execution is using.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The resource name of the execution.
     * Format:
     * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. The resource name of the execution.
     * Format:
     * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Output only. Marks the beginning of execution.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getStartTime()
    {
        return $this->start_time;
    }

    public function hasStartTime()
    {
        return isset($this->start_time);
    }

    public function clearStartTime()
    {
        unset($this->start_time);
    }

    /**
     * Output only. Marks the beginning of execution.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setStartTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->start_time = $var;

        return $this;
    }

    /**
     * Output only. Marks the end of execution, successful or not.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getEndTime()
    {
        return $this->end_time;
    }

    public function hasEndTime()
    {
        return isset($this->end_time);
    }

    public function clearEndTime()
    {
        unset($this->end_time);
    }

    /**
     * Output only. Marks the end of execution, successful or not.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setEndTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->end_time = $var;

        return $this;
    }

    /**
     * Output only. Current state of the execution.
     *
     * Generated from protobuf field <code>.google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Output only. Current state of the execution.
     *
     * Generated from protobuf field <code>.google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1beta\Execution\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Input parameters of the execution represented as a JSON string.
     * The size limit is 32KB.
     *
     * Generated from protobuf field <code>string argument = 5;</code>
     * @return string
     */
    public function getArgument()
    {
        return $this->argument;
    }

    /**
     * Input parameters of the execution represented as a JSON string.
     * The size limit is 32KB.
     *
     * Generated from protobuf field <code>string argument = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setArgument($var)
    {
        GPBUtil::checkString($var, True);
        $this->argument = $var;

        return $this;
    }

    /**
     * Output only. Output of the execution represented as a JSON string. The
     * value can only be present if the execution's state is `SUCCEEDED`.
     *
     * Generated from protobuf field <code>string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getResult()
    {
        return $this->result;
    }

    /**
     * Output only. Output of the execution represented as a JSON string. The
     * value can only be present if the execution's state is `SUCCEEDED`.
     *
     * Generated from protobuf field <code>string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setResult($var)
    {
        GPBUtil::checkString($var, True);
        $this->result = $var;

        return $this;
    }

    /**
     * Output only. The error which caused the execution to finish prematurely.
     * The value is only present if the execution's state is `FAILED`
     * or `CANCELLED`.
     *
     * Generated from protobuf field <code>.google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Cloud\Workflows\Executions\V1beta\Execution\Error|null
     */
    public function getError()
    {
        return $this->error;
    }

    public function hasError()
    {
        return isset($this->error);
    }

    public function clearError()
    {
        unset($this->error);
    }

    /**
     * Output only. The error which caused the execution to finish prematurely.
     * The value is only present if the execution's state is `FAILED`
     * or `CANCELLED`.
     *
     * Generated from protobuf field <code>.google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Cloud\Workflows\Executions\V1beta\Execution\Error $var
     * @return $this
     */
    public function setError($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1beta\Execution\Error::class);
        $this->error = $var;

        return $this;
    }

    /**
     * Output only. Revision of the workflow this execution is using.
     *
     * Generated from protobuf field <code>string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getWorkflowRevisionId()
    {
        return $this->workflow_revision_id;
    }

    /**
     * Output only. Revision of the workflow this execution is using.
     *
     * Generated from protobuf field <code>string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setWorkflowRevisionId($var)
    {
        GPBUtil::checkString($var, True);
        $this->workflow_revision_id = $var;

        return $this;
    }

}

