<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: core/Tron.proto

namespace Protocol;

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

/**
 * Generated from protobuf message <code>protocol.Permission</code>
 */
class Permission extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>.protocol.Permission.PermissionType type = 1;</code>
     */
    protected $type = 0;
    /**
     *Owner id=0, Witness id=1, Active id start by 2
     *
     * Generated from protobuf field <code>int32 id = 2;</code>
     */
    protected $id = 0;
    /**
     * Generated from protobuf field <code>string permission_name = 3;</code>
     */
    protected $permission_name = '';
    /**
     * Generated from protobuf field <code>int64 threshold = 4;</code>
     */
    protected $threshold = 0;
    /**
     * Generated from protobuf field <code>int32 parent_id = 5;</code>
     */
    protected $parent_id = 0;
    /**
     *1 bit 1 contract
     *
     * Generated from protobuf field <code>bytes operations = 6;</code>
     */
    protected $operations = '';
    /**
     * Generated from protobuf field <code>repeated .protocol.Key keys = 7;</code>
     */
    private $keys;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $type
     *     @type int $id
     *          Owner id=0, Witness id=1, Active id start by 2
     *     @type string $permission_name
     *     @type int|string $threshold
     *     @type int $parent_id
     *     @type string $operations
     *          1 bit 1 contract
     *     @type \Protocol\Key[]|\Google\Protobuf\Internal\RepeatedField $keys
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Core\Tron::initOnce();
        parent::__construct($data);
    }

    /**
     * Generated from protobuf field <code>.protocol.Permission.PermissionType type = 1;</code>
     * @return int
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Generated from protobuf field <code>.protocol.Permission.PermissionType type = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setType($var)
    {
        GPBUtil::checkEnum($var, \Protocol\Permission\PermissionType::class);
        $this->type = $var;

        return $this;
    }

    /**
     *Owner id=0, Witness id=1, Active id start by 2
     *
     * Generated from protobuf field <code>int32 id = 2;</code>
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     *Owner id=0, Witness id=1, Active id start by 2
     *
     * Generated from protobuf field <code>int32 id = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkInt32($var);
        $this->id = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>string permission_name = 3;</code>
     * @return string
     */
    public function getPermissionName()
    {
        return $this->permission_name;
    }

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

        return $this;
    }

    /**
     * Generated from protobuf field <code>int64 threshold = 4;</code>
     * @return int|string
     */
    public function getThreshold()
    {
        return $this->threshold;
    }

    /**
     * Generated from protobuf field <code>int64 threshold = 4;</code>
     * @param int|string $var
     * @return $this
     */
    public function setThreshold($var)
    {
        GPBUtil::checkInt64($var);
        $this->threshold = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>int32 parent_id = 5;</code>
     * @return int
     */
    public function getParentId()
    {
        return $this->parent_id;
    }

    /**
     * Generated from protobuf field <code>int32 parent_id = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setParentId($var)
    {
        GPBUtil::checkInt32($var);
        $this->parent_id = $var;

        return $this;
    }

    /**
     *1 bit 1 contract
     *
     * Generated from protobuf field <code>bytes operations = 6;</code>
     * @return string
     */
    public function getOperations()
    {
        return $this->operations;
    }

    /**
     *1 bit 1 contract
     *
     * Generated from protobuf field <code>bytes operations = 6;</code>
     * @param string $var
     * @return $this
     */
    public function setOperations($var)
    {
        GPBUtil::checkString($var, False);
        $this->operations = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>repeated .protocol.Key keys = 7;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getKeys()
    {
        return $this->keys;
    }

    /**
     * Generated from protobuf field <code>repeated .protocol.Key keys = 7;</code>
     * @param \Protocol\Key[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setKeys($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Protocol\Key::class);
        $this->keys = $arr;

        return $this;
    }

}

