<?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;

/**
 * CallbackInfo contains the state of an attached workflow callback.
 *
 * Generated from protobuf message <code>temporal.api.workflow.v1.CallbackInfo</code>
 */
class CallbackInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * Information on how this callback should be invoked (e.g. its URL and type).
     *
     * Generated from protobuf field <code>.temporal.api.common.v1.Callback callback = 1;</code>
     */
    protected $callback = null;
    /**
     * Trigger for this callback.
     *
     * Generated from protobuf field <code>.temporal.api.workflow.v1.CallbackInfo.Trigger trigger = 2;</code>
     */
    protected $trigger = null;
    /**
     * The time when the callback was registered.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp registration_time = 3;</code>
     */
    protected $registration_time = null;
    /**
     * Generated from protobuf field <code>.temporal.api.enums.v1.CallbackState state = 4;</code>
     */
    protected $state = 0;
    /**
     * The number of attempts made to deliver the callback.
     * This number represents a minimum bound since the attempt is incremented after the callback request completes.
     *
     * Generated from protobuf field <code>int32 attempt = 5;</code>
     */
    protected $attempt = 0;
    /**
     * The time when the last attempt completed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_attempt_complete_time = 6;</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 = 7;</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 = 8;</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 = 9;</code>
     */
    protected $blocked_reason = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Temporal\Api\Common\V1\Callback $callback
     *           Information on how this callback should be invoked (e.g. its URL and type).
     *     @type \Temporal\Api\Workflow\V1\CallbackInfo\Trigger $trigger
     *           Trigger for this callback.
     *     @type \Google\Protobuf\Timestamp $registration_time
     *           The time when the callback was registered.
     *     @type int $state
     *     @type int $attempt
     *           The number of attempts made to deliver the callback.
     *           This number represents a minimum bound since the attempt is incremented after the callback 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);
    }

    /**
     * Information on how this callback should be invoked (e.g. its URL and type).
     *
     * Generated from protobuf field <code>.temporal.api.common.v1.Callback callback = 1;</code>
     * @return \Temporal\Api\Common\V1\Callback|null
     */
    public function getCallback()
    {
        return $this->callback;
    }

    public function hasCallback()
    {
        return isset($this->callback);
    }

    public function clearCallback()
    {
        unset($this->callback);
    }

    /**
     * Information on how this callback should be invoked (e.g. its URL and type).
     *
     * Generated from protobuf field <code>.temporal.api.common.v1.Callback callback = 1;</code>
     * @param \Temporal\Api\Common\V1\Callback $var
     * @return $this
     */
    public function setCallback($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Common\V1\Callback::class);
        $this->callback = $var;

        return $this;
    }

    /**
     * Trigger for this callback.
     *
     * Generated from protobuf field <code>.temporal.api.workflow.v1.CallbackInfo.Trigger trigger = 2;</code>
     * @return \Temporal\Api\Workflow\V1\CallbackInfo\Trigger|null
     */
    public function getTrigger()
    {
        return $this->trigger;
    }

    public function hasTrigger()
    {
        return isset($this->trigger);
    }

    public function clearTrigger()
    {
        unset($this->trigger);
    }

    /**
     * Trigger for this callback.
     *
     * Generated from protobuf field <code>.temporal.api.workflow.v1.CallbackInfo.Trigger trigger = 2;</code>
     * @param \Temporal\Api\Workflow\V1\CallbackInfo\Trigger $var
     * @return $this
     */
    public function setTrigger($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Workflow\V1\CallbackInfo\Trigger::class);
        $this->trigger = $var;

        return $this;
    }

    /**
     * The time when the callback was registered.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp registration_time = 3;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getRegistrationTime()
    {
        return $this->registration_time;
    }

    public function hasRegistrationTime()
    {
        return isset($this->registration_time);
    }

    public function clearRegistrationTime()
    {
        unset($this->registration_time);
    }

    /**
     * The time when the callback was registered.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp registration_time = 3;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setRegistrationTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->registration_time = $var;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * The number of attempts made to deliver the callback.
     * This number represents a minimum bound since the attempt is incremented after the callback request completes.
     *
     * Generated from protobuf field <code>int32 attempt = 5;</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 = 6;</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 = 6;</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 = 7;</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 = 7;</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 = 8;</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 = 8;</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 = 9;</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 = 9;</code>
     * @param string $var
     * @return $this
     */
    public function setBlockedReason($var)
    {
        GPBUtil::checkString($var, True);
        $this->blocked_reason = $var;

        return $this;
    }

}

