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

namespace Google\Cloud\AIPlatform\V1\StudySpec;

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

/**
 * Represents a metric to optimize.
 *
 * Generated from protobuf message <code>google.cloud.aiplatform.v1.StudySpec.MetricSpec</code>
 */
class MetricSpec extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The ID of the metric. Must not contain whitespaces and must be
     * unique amongst all MetricSpecs.
     *
     * Generated from protobuf field <code>string metric_id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $metric_id = '';
    /**
     * Required. The optimization goal of the metric.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.StudySpec.MetricSpec.GoalType goal = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $goal = 0;
    /**
     * Used for safe search. In the case, the metric will be a safety
     * metric. You must provide a separate metric for objective metric.
     *
     * Generated from protobuf field <code>optional .google.cloud.aiplatform.v1.StudySpec.MetricSpec.SafetyMetricConfig safety_config = 3;</code>
     */
    protected $safety_config = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $metric_id
     *           Required. The ID of the metric. Must not contain whitespaces and must be
     *           unique amongst all MetricSpecs.
     *     @type int $goal
     *           Required. The optimization goal of the metric.
     *     @type \Google\Cloud\AIPlatform\V1\StudySpec\MetricSpec\SafetyMetricConfig $safety_config
     *           Used for safe search. In the case, the metric will be a safety
     *           metric. You must provide a separate metric for objective metric.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Aiplatform\V1\Study::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The ID of the metric. Must not contain whitespaces and must be
     * unique amongst all MetricSpecs.
     *
     * Generated from protobuf field <code>string metric_id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getMetricId()
    {
        return $this->metric_id;
    }

    /**
     * Required. The ID of the metric. Must not contain whitespaces and must be
     * unique amongst all MetricSpecs.
     *
     * Generated from protobuf field <code>string metric_id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setMetricId($var)
    {
        GPBUtil::checkString($var, True);
        $this->metric_id = $var;

        return $this;
    }

    /**
     * Required. The optimization goal of the metric.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.StudySpec.MetricSpec.GoalType goal = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getGoal()
    {
        return $this->goal;
    }

    /**
     * Required. The optimization goal of the metric.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.StudySpec.MetricSpec.GoalType goal = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setGoal($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\AIPlatform\V1\StudySpec\MetricSpec\GoalType::class);
        $this->goal = $var;

        return $this;
    }

    /**
     * Used for safe search. In the case, the metric will be a safety
     * metric. You must provide a separate metric for objective metric.
     *
     * Generated from protobuf field <code>optional .google.cloud.aiplatform.v1.StudySpec.MetricSpec.SafetyMetricConfig safety_config = 3;</code>
     * @return \Google\Cloud\AIPlatform\V1\StudySpec\MetricSpec\SafetyMetricConfig|null
     */
    public function getSafetyConfig()
    {
        return $this->safety_config;
    }

    public function hasSafetyConfig()
    {
        return isset($this->safety_config);
    }

    public function clearSafetyConfig()
    {
        unset($this->safety_config);
    }

    /**
     * Used for safe search. In the case, the metric will be a safety
     * metric. You must provide a separate metric for objective metric.
     *
     * Generated from protobuf field <code>optional .google.cloud.aiplatform.v1.StudySpec.MetricSpec.SafetyMetricConfig safety_config = 3;</code>
     * @param \Google\Cloud\AIPlatform\V1\StudySpec\MetricSpec\SafetyMetricConfig $var
     * @return $this
     */
    public function setSafetyConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\StudySpec\MetricSpec\SafetyMetricConfig::class);
        $this->safety_config = $var;

        return $this;
    }

}

