<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/analytics/admin/v1alpha/analytics_admin.proto

namespace Google\Analytics\Admin\V1alpha;

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

/**
 * Request message for CreateCalculatedMetric RPC.
 *
 * Generated from protobuf message <code>google.analytics.admin.v1alpha.CreateCalculatedMetricRequest</code>
 */
class CreateCalculatedMetricRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Format: properties/{property_id}
     * Example: properties/1234
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $parent = '';
    /**
     * Required. The ID to use for the calculated metric which will become the
     * final component of the calculated metric's resource name.
     * This value should be 1-80 characters and valid characters are
     * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
     * between all calculated metrics under a property. The calculated_metric_id
     * is used when referencing this calculated metric from external APIs, for
     * example, "calcMetric:{calculated_metric_id}".
     *
     * Generated from protobuf field <code>string calculated_metric_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $calculated_metric_id = '';
    /**
     * Required. The CalculatedMetric to create.
     *
     * Generated from protobuf field <code>.google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $calculated_metric = null;

    /**
     * @param string                                           $parent             Required. Format: properties/{property_id}
     *                                                                             Example: properties/1234
     *                                                                             Please see {@see AnalyticsAdminServiceClient::propertyName()} for help formatting this field.
     * @param \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculatedMetric   Required. The CalculatedMetric to create.
     * @param string                                           $calculatedMetricId Required. The ID to use for the calculated metric which will become the
     *                                                                             final component of the calculated metric's resource name.
     *
     *                                                                             This value should be 1-80 characters and valid characters are
     *                                                                             /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
     *                                                                             between all calculated metrics under a property. The calculated_metric_id
     *                                                                             is used when referencing this calculated metric from external APIs, for
     *                                                                             example, "calcMetric:{calculated_metric_id}".
     *
     * @return \Google\Analytics\Admin\V1alpha\CreateCalculatedMetricRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculatedMetric, string $calculatedMetricId): self
    {
        return (new self())
            ->setParent($parent)
            ->setCalculatedMetric($calculatedMetric)
            ->setCalculatedMetricId($calculatedMetricId);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. Format: properties/{property_id}
     *           Example: properties/1234
     *     @type string $calculated_metric_id
     *           Required. The ID to use for the calculated metric which will become the
     *           final component of the calculated metric's resource name.
     *           This value should be 1-80 characters and valid characters are
     *           /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
     *           between all calculated metrics under a property. The calculated_metric_id
     *           is used when referencing this calculated metric from external APIs, for
     *           example, "calcMetric:{calculated_metric_id}".
     *     @type \Google\Analytics\Admin\V1alpha\CalculatedMetric $calculated_metric
     *           Required. The CalculatedMetric to create.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Analytics\Admin\V1Alpha\AnalyticsAdmin::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Format: properties/{property_id}
     * Example: properties/1234
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Required. Format: properties/{property_id}
     * Example: properties/1234
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setParent($var)
    {
        GPBUtil::checkString($var, True);
        $this->parent = $var;

        return $this;
    }

    /**
     * Required. The ID to use for the calculated metric which will become the
     * final component of the calculated metric's resource name.
     * This value should be 1-80 characters and valid characters are
     * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
     * between all calculated metrics under a property. The calculated_metric_id
     * is used when referencing this calculated metric from external APIs, for
     * example, "calcMetric:{calculated_metric_id}".
     *
     * Generated from protobuf field <code>string calculated_metric_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getCalculatedMetricId()
    {
        return $this->calculated_metric_id;
    }

    /**
     * Required. The ID to use for the calculated metric which will become the
     * final component of the calculated metric's resource name.
     * This value should be 1-80 characters and valid characters are
     * /[a-zA-Z0-9_]/, no spaces allowed. calculated_metric_id must be unique
     * between all calculated metrics under a property. The calculated_metric_id
     * is used when referencing this calculated metric from external APIs, for
     * example, "calcMetric:{calculated_metric_id}".
     *
     * Generated from protobuf field <code>string calculated_metric_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setCalculatedMetricId($var)
    {
        GPBUtil::checkString($var, True);
        $this->calculated_metric_id = $var;

        return $this;
    }

    /**
     * Required. The CalculatedMetric to create.
     *
     * Generated from protobuf field <code>.google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Analytics\Admin\V1alpha\CalculatedMetric|null
     */
    public function getCalculatedMetric()
    {
        return $this->calculated_metric;
    }

    public function hasCalculatedMetric()
    {
        return isset($this->calculated_metric);
    }

    public function clearCalculatedMetric()
    {
        unset($this->calculated_metric);
    }

    /**
     * Required. The CalculatedMetric to create.
     *
     * Generated from protobuf field <code>.google.analytics.admin.v1alpha.CalculatedMetric calculated_metric = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Analytics\Admin\V1alpha\CalculatedMetric $var
     * @return $this
     */
    public function setCalculatedMetric($var)
    {
        GPBUtil::checkMessage($var, \Google\Analytics\Admin\V1alpha\CalculatedMetric::class);
        $this->calculated_metric = $var;

        return $this;
    }

}

