<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/aiplatform/v1/content.proto

namespace Google\Cloud\AIPlatform\V1\LogprobsResult;

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

/**
 * Candidate for the logprobs token and score.
 *
 * Generated from protobuf message <code>google.cloud.aiplatform.v1.LogprobsResult.Candidate</code>
 */
class Candidate extends \Google\Protobuf\Internal\Message
{
    /**
     * The candidate’s token string value.
     *
     * Generated from protobuf field <code>optional string token = 1;</code>
     */
    protected $token = null;
    /**
     * The candidate’s token id value.
     *
     * Generated from protobuf field <code>optional int32 token_id = 3;</code>
     */
    protected $token_id = null;
    /**
     * The candidate's log probability.
     *
     * Generated from protobuf field <code>optional float log_probability = 2;</code>
     */
    protected $log_probability = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $token
     *           The candidate’s token string value.
     *     @type int $token_id
     *           The candidate’s token id value.
     *     @type float $log_probability
     *           The candidate's log probability.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Aiplatform\V1\Content::initOnce();
        parent::__construct($data);
    }

    /**
     * The candidate’s token string value.
     *
     * Generated from protobuf field <code>optional string token = 1;</code>
     * @return string
     */
    public function getToken()
    {
        return isset($this->token) ? $this->token : '';
    }

    public function hasToken()
    {
        return isset($this->token);
    }

    public function clearToken()
    {
        unset($this->token);
    }

    /**
     * The candidate’s token string value.
     *
     * Generated from protobuf field <code>optional string token = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setToken($var)
    {
        GPBUtil::checkString($var, True);
        $this->token = $var;

        return $this;
    }

    /**
     * The candidate’s token id value.
     *
     * Generated from protobuf field <code>optional int32 token_id = 3;</code>
     * @return int
     */
    public function getTokenId()
    {
        return isset($this->token_id) ? $this->token_id : 0;
    }

    public function hasTokenId()
    {
        return isset($this->token_id);
    }

    public function clearTokenId()
    {
        unset($this->token_id);
    }

    /**
     * The candidate’s token id value.
     *
     * Generated from protobuf field <code>optional int32 token_id = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setTokenId($var)
    {
        GPBUtil::checkInt32($var);
        $this->token_id = $var;

        return $this;
    }

    /**
     * The candidate's log probability.
     *
     * Generated from protobuf field <code>optional float log_probability = 2;</code>
     * @return float
     */
    public function getLogProbability()
    {
        return isset($this->log_probability) ? $this->log_probability : 0.0;
    }

    public function hasLogProbability()
    {
        return isset($this->log_probability);
    }

    public function clearLogProbability()
    {
        unset($this->log_probability);
    }

    /**
     * The candidate's log probability.
     *
     * Generated from protobuf field <code>optional float log_probability = 2;</code>
     * @param float $var
     * @return $this
     */
    public function setLogProbability($var)
    {
        GPBUtil::checkFloat($var);
        $this->log_probability = $var;

        return $this;
    }

}

