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

namespace Temporal\Api\Nexus\V1;

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

/**
 * Generated from protobuf message <code>temporal.api.nexus.v1.HandlerError</code>
 */
class HandlerError extends \Google\Protobuf\Internal\Message
{
    /**
     * See https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.
     *
     * Generated from protobuf field <code>string error_type = 1;</code>
     */
    protected $error_type = '';
    /**
     * Generated from protobuf field <code>.temporal.api.nexus.v1.Failure failure = 2;</code>
     */
    protected $failure = null;
    /**
     * Retry behavior, defaults to the retry behavior of the error type as defined in the spec.
     *
     * Generated from protobuf field <code>.temporal.api.enums.v1.NexusHandlerErrorRetryBehavior retry_behavior = 3;</code>
     */
    protected $retry_behavior = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $error_type
     *           See https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.
     *     @type \Temporal\Api\Nexus\V1\Failure $failure
     *     @type int $retry_behavior
     *           Retry behavior, defaults to the retry behavior of the error type as defined in the spec.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Temporal\Api\Nexus\V1\Message::initOnce();
        parent::__construct($data);
    }

    /**
     * See https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.
     *
     * Generated from protobuf field <code>string error_type = 1;</code>
     * @return string
     */
    public function getErrorType()
    {
        return $this->error_type;
    }

    /**
     * See https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.
     *
     * Generated from protobuf field <code>string error_type = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setErrorType($var)
    {
        GPBUtil::checkString($var, True);
        $this->error_type = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.temporal.api.nexus.v1.Failure failure = 2;</code>
     * @return \Temporal\Api\Nexus\V1\Failure|null
     */
    public function getFailure()
    {
        return $this->failure;
    }

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

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

    /**
     * Generated from protobuf field <code>.temporal.api.nexus.v1.Failure failure = 2;</code>
     * @param \Temporal\Api\Nexus\V1\Failure $var
     * @return $this
     */
    public function setFailure($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Nexus\V1\Failure::class);
        $this->failure = $var;

        return $this;
    }

    /**
     * Retry behavior, defaults to the retry behavior of the error type as defined in the spec.
     *
     * Generated from protobuf field <code>.temporal.api.enums.v1.NexusHandlerErrorRetryBehavior retry_behavior = 3;</code>
     * @return int
     */
    public function getRetryBehavior()
    {
        return $this->retry_behavior;
    }

    /**
     * Retry behavior, defaults to the retry behavior of the error type as defined in the spec.
     *
     * Generated from protobuf field <code>.temporal.api.enums.v1.NexusHandlerErrorRetryBehavior retry_behavior = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setRetryBehavior($var)
    {
        GPBUtil::checkEnum($var, \Temporal\Api\Enums\V1\NexusHandlerErrorRetryBehavior::class);
        $this->retry_behavior = $var;

        return $this;
    }

}

