<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: apache/rocketmq/v2/definition.proto

namespace Apache\Rocketmq\V2;

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

/**
 * When publishing messages to or subscribing messages from brokers, clients
 * shall include or validate digests of message body to ensure data integrity.
 * For message publishing, when an invalid digest were detected, brokers need
 * respond client with BAD_REQUEST.
 * For messages subscription, when an invalid digest were detected, consumers
 * need to handle this case according to message type:
 * 1) Standard messages should be negatively acknowledged instantly, causing
 * immediate re-delivery; 2) FIFO messages require special RPC, to re-fetch
 * previously acquired messages batch;
 * Message consumption model also affects how invalid digest are handled. When
 * messages are consumed in broadcasting way,
 * TODO: define semantics of invalid-digest-when-broadcasting.
 *
 * Generated from protobuf message <code>apache.rocketmq.v2.Digest</code>
 */
class Digest extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>.apache.rocketmq.v2.DigestType type = 1;</code>
     */
    protected $type = 0;
    /**
     * Generated from protobuf field <code>string checksum = 2;</code>
     */
    protected $checksum = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $type
     *     @type string $checksum
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Apache\Rocketmq\V2\Definition::initOnce();
        parent::__construct($data);
    }

    /**
     * Generated from protobuf field <code>.apache.rocketmq.v2.DigestType type = 1;</code>
     * @return int
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Generated from protobuf field <code>.apache.rocketmq.v2.DigestType type = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setType($var)
    {
        GPBUtil::checkEnum($var, \Apache\Rocketmq\V2\DigestType::class);
        $this->type = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>string checksum = 2;</code>
     * @return string
     */
    public function getChecksum()
    {
        return $this->checksum;
    }

    /**
     * Generated from protobuf field <code>string checksum = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setChecksum($var)
    {
        GPBUtil::checkString($var, True);
        $this->checksum = $var;

        return $this;
    }

}

