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

namespace Temporal\Api\Workflow\V1;

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

/**
 * NexusOperationCancellationInfo contains the state of a nexus operation cancellation.
 *
 * Generated from protobuf message <code>temporal.api.workflow.v1.NexusOperationCancellationInfo</code>
 */
class NexusOperationCancellationInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * The time when cancellation was requested.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp requested_time = 1;</code>
     */
    protected $requested_time = null;
    /**
     * Generated from protobuf field <code>.temporal.api.enums.v1.NexusOperationCancellationState state = 2;</code>
     */
    protected $state = 0;
    /**
     * The number of attempts made to deliver the cancel operation request.
     * This number represents a minimum bound since the attempt is incremented after the request completes.
     *
     * Generated from protobuf field <code>int32 attempt = 3;</code>
     */
    protected $attempt = 0;
    /**
     * The time when the last attempt completed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_attempt_complete_time = 4;</code>
     */
    protected $last_attempt_complete_time = null;
    /**
     * The last attempt's failure, if any.
     *
     * Generated from protobuf field <code>.temporal.api.failure.v1.Failure last_attempt_failure = 5;</code>
     */
    protected $last_attempt_failure = null;
    /**
     * The time when the next attempt is scheduled.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp next_attempt_schedule_time = 6;</code>
     */
    protected $next_attempt_schedule_time = null;
    /**
     * If the state is BLOCKED, blocked reason provides additional information.
     *
     * Generated from protobuf field <code>string blocked_reason = 7;</code>
     */
    protected $blocked_reason = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Timestamp $requested_time
     *           The time when cancellation was requested.
     *     @type int $state
     *     @type int $attempt
     *           The number of attempts made to deliver the cancel operation request.
     *           This number represents a minimum bound since the attempt is incremented after the request completes.
     *     @type \Google\Protobuf\Timestamp $last_attempt_complete_time
     *           The time when the last attempt completed.
     *     @type \Temporal\Api\Failure\V1\Failure $last_attempt_failure
     *           The last attempt's failure, if any.
     *     @type \Google\Protobuf\Timestamp $next_attempt_schedule_time
     *           The time when the next attempt is scheduled.
     *     @type string $blocked_reason
     *           If the state is BLOCKED, blocked reason provides additional information.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Temporal\Api\Workflow\V1\Message::initOnce();
        parent::__construct($data);
    }

    /**
     * The time when cancellation was requested.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp requested_time = 1;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getRequestedTime()
    {
        return $this->requested_time;
    }

    public function hasRequestedTime()
    {
        return isset($this->requested_time);
    }

    public function clearRequestedTime()
    {
        unset($this->requested_time);
    }

    /**
     * The time when cancellation was requested.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp requested_time = 1;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setRequestedTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->requested_time = $var;

        return $this;
    }

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

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

        return $this;
    }

    /**
     * The number of attempts made to deliver the cancel operation request.
     * This number represents a minimum bound since the attempt is incremented after the request completes.
     *
     * Generated from protobuf field <code>int32 attempt = 3;</code>
     * @return int
     */
    public function getAttempt()
    {
        return $this->attempt;
    }

    /**
     * The number of attempts made to deliver the cancel operation request.
     * This number represents a minimum bound since the attempt is incremented after the request completes.
     *
     * Generated from protobuf field <code>int32 attempt = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setAttempt($var)
    {
        GPBUtil::checkInt32($var);
        $this->attempt = $var;

        return $this;
    }

    /**
     * The time when the last attempt completed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_attempt_complete_time = 4;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getLastAttemptCompleteTime()
    {
        return $this->last_attempt_complete_time;
    }

    public function hasLastAttemptCompleteTime()
    {
        return isset($this->last_attempt_complete_time);
    }

    public function clearLastAttemptCompleteTime()
    {
        unset($this->last_attempt_complete_time);
    }

    /**
     * The time when the last attempt completed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_attempt_complete_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setLastAttemptCompleteTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->last_attempt_complete_time = $var;

        return $this;
    }

    /**
     * The last attempt's failure, if any.
     *
     * Generated from protobuf field <code>.temporal.api.failure.v1.Failure last_attempt_failure = 5;</code>
     * @return \Temporal\Api\Failure\V1\Failure|null
     */
    public function getLastAttemptFailure()
    {
        return $this->last_attempt_failure;
    }

    public function hasLastAttemptFailure()
    {
        return isset($this->last_attempt_failure);
    }

    public function clearLastAttemptFailure()
    {
        unset($this->last_attempt_failure);
    }

    /**
     * The last attempt's failure, if any.
     *
     * Generated from protobuf field <code>.temporal.api.failure.v1.Failure last_attempt_failure = 5;</code>
     * @param \Temporal\Api\Failure\V1\Failure $var
     * @return $this
     */
    public function setLastAttemptFailure($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Failure\V1\Failure::class);
        $this->last_attempt_failure = $var;

        return $this;
    }

    /**
     * The time when the next attempt is scheduled.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp next_attempt_schedule_time = 6;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getNextAttemptScheduleTime()
    {
        return $this->next_attempt_schedule_time;
    }

    public function hasNextAttemptScheduleTime()
    {
        return isset($this->next_attempt_schedule_time);
    }

    public function clearNextAttemptScheduleTime()
    {
        unset($this->next_attempt_schedule_time);
    }

    /**
     * The time when the next attempt is scheduled.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp next_attempt_schedule_time = 6;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setNextAttemptScheduleTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->next_attempt_schedule_time = $var;

        return $this;
    }

    /**
     * If the state is BLOCKED, blocked reason provides additional information.
     *
     * Generated from protobuf field <code>string blocked_reason = 7;</code>
     * @return string
     */
    public function getBlockedReason()
    {
        return $this->blocked_reason;
    }

    /**
     * If the state is BLOCKED, blocked reason provides additional information.
     *
     * Generated from protobuf field <code>string blocked_reason = 7;</code>
     * @param string $var
     * @return $this
     */
    public function setBlockedReason($var)
    {
        GPBUtil::checkString($var, True);
        $this->blocked_reason = $var;

        return $this;
    }

}

