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

namespace Temporal\Api\History\V1;

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

/**
 * Generated from protobuf message <code>temporal.api.history.v1.WorkflowExecutionFailedEventAttributes</code>
 */
class WorkflowExecutionFailedEventAttributes extends \Google\Protobuf\Internal\Message
{
    /**
     * Serialized result of workflow failure (ex: An exception thrown, or error returned)
     *
     * Generated from protobuf field <code>.temporal.api.failure.v1.Failure failure = 1;</code>
     */
    protected $failure = null;
    /**
     * Generated from protobuf field <code>.temporal.api.enums.v1.RetryState retry_state = 2;</code>
     */
    protected $retry_state = 0;
    /**
     * The `WORKFLOW_TASK_COMPLETED` event which this command was reported with
     *
     * Generated from protobuf field <code>int64 workflow_task_completed_event_id = 3;</code>
     */
    protected $workflow_task_completed_event_id = 0;
    /**
     * If another run is started by cron or retry, this contains the new run id.
     *
     * Generated from protobuf field <code>string new_execution_run_id = 4;</code>
     */
    protected $new_execution_run_id = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Temporal\Api\Failure\V1\Failure $failure
     *           Serialized result of workflow failure (ex: An exception thrown, or error returned)
     *     @type int $retry_state
     *     @type int|string $workflow_task_completed_event_id
     *           The `WORKFLOW_TASK_COMPLETED` event which this command was reported with
     *     @type string $new_execution_run_id
     *           If another run is started by cron or retry, this contains the new run id.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Temporal\Api\History\V1\Message::initOnce();
        parent::__construct($data);
    }

    /**
     * Serialized result of workflow failure (ex: An exception thrown, or error returned)
     *
     * Generated from protobuf field <code>.temporal.api.failure.v1.Failure failure = 1;</code>
     * @return \Temporal\Api\Failure\V1\Failure|null
     */
    public function getFailure()
    {
        return $this->failure;
    }

    public function hasFailure()
    {
        return isset($this->failure);
    }

    public function clearFailure()
    {
        unset($this->failure);
    }

    /**
     * Serialized result of workflow failure (ex: An exception thrown, or error returned)
     *
     * Generated from protobuf field <code>.temporal.api.failure.v1.Failure failure = 1;</code>
     * @param \Temporal\Api\Failure\V1\Failure $var
     * @return $this
     */
    public function setFailure($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Failure\V1\Failure::class);
        $this->failure = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.temporal.api.enums.v1.RetryState retry_state = 2;</code>
     * @return int
     */
    public function getRetryState()
    {
        return $this->retry_state;
    }

    /**
     * Generated from protobuf field <code>.temporal.api.enums.v1.RetryState retry_state = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setRetryState($var)
    {
        GPBUtil::checkEnum($var, \Temporal\Api\Enums\V1\RetryState::class);
        $this->retry_state = $var;

        return $this;
    }

    /**
     * The `WORKFLOW_TASK_COMPLETED` event which this command was reported with
     *
     * Generated from protobuf field <code>int64 workflow_task_completed_event_id = 3;</code>
     * @return int|string
     */
    public function getWorkflowTaskCompletedEventId()
    {
        return $this->workflow_task_completed_event_id;
    }

    /**
     * The `WORKFLOW_TASK_COMPLETED` event which this command was reported with
     *
     * Generated from protobuf field <code>int64 workflow_task_completed_event_id = 3;</code>
     * @param int|string $var
     * @return $this
     */
    public function setWorkflowTaskCompletedEventId($var)
    {
        GPBUtil::checkInt64($var);
        $this->workflow_task_completed_event_id = $var;

        return $this;
    }

    /**
     * If another run is started by cron or retry, this contains the new run id.
     *
     * Generated from protobuf field <code>string new_execution_run_id = 4;</code>
     * @return string
     */
    public function getNewExecutionRunId()
    {
        return $this->new_execution_run_id;
    }

    /**
     * If another run is started by cron or retry, this contains the new run id.
     *
     * Generated from protobuf field <code>string new_execution_run_id = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setNewExecutionRunId($var)
    {
        GPBUtil::checkString($var, True);
        $this->new_execution_run_id = $var;

        return $this;
    }

}

