<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: opentelemetry/proto/profiles/v1development/profiles.proto

namespace Opentelemetry\Proto\Profiles\V1development;

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

/**
 * A custom 'dictionary native' style of encoding attributes which is more convenient
 * for profiles than opentelemetry.proto.common.v1.KeyValue
 * Specifically, uses the string table for keys and allows optional unit information.
 *
 * Generated from protobuf message <code>opentelemetry.proto.profiles.v1development.KeyValueAndUnit</code>
 */
class KeyValueAndUnit extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>int32 key_strindex = 1;</code>
     */
    protected $key_strindex = 0;
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.common.v1.AnyValue value = 2;</code>
     */
    protected $value = null;
    /**
     * zero indicates implicit (by semconv) or non-defined unit.
     *
     * Generated from protobuf field <code>int32 unit_strindex = 3;</code>
     */
    protected $unit_strindex = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $key_strindex
     *     @type \Opentelemetry\Proto\Common\V1\AnyValue $value
     *     @type int $unit_strindex
     *           zero indicates implicit (by semconv) or non-defined unit.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Opentelemetry\Proto\Profiles\V1Development\Profiles::initOnce();
        parent::__construct($data);
    }

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

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

        return $this;
    }

    /**
     * Generated from protobuf field <code>.opentelemetry.proto.common.v1.AnyValue value = 2;</code>
     * @return \Opentelemetry\Proto\Common\V1\AnyValue|null
     */
    public function getValue()
    {
        return $this->value;
    }

    public function hasValue()
    {
        return isset($this->value);
    }

    public function clearValue()
    {
        unset($this->value);
    }

    /**
     * Generated from protobuf field <code>.opentelemetry.proto.common.v1.AnyValue value = 2;</code>
     * @param \Opentelemetry\Proto\Common\V1\AnyValue $var
     * @return $this
     */
    public function setValue($var)
    {
        GPBUtil::checkMessage($var, \Opentelemetry\Proto\Common\V1\AnyValue::class);
        $this->value = $var;

        return $this;
    }

    /**
     * zero indicates implicit (by semconv) or non-defined unit.
     *
     * Generated from protobuf field <code>int32 unit_strindex = 3;</code>
     * @return int
     */
    public function getUnitStrindex()
    {
        return $this->unit_strindex;
    }

    /**
     * zero indicates implicit (by semconv) or non-defined unit.
     *
     * Generated from protobuf field <code>int32 unit_strindex = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setUnitStrindex($var)
    {
        GPBUtil::checkInt32($var);
        $this->unit_strindex = $var;

        return $this;
    }

}

