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

namespace Google\Cloud\Asset\V1;

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

/**
 * Request to create a saved query.
 *
 * Generated from protobuf message <code>google.cloud.asset.v1.CreateSavedQueryRequest</code>
 */
class CreateSavedQueryRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The name of the project/folder/organization where this
     * saved_query should be created in. It can only be an organization number
     * (such as "organizations/123"), a folder number (such as "folders/123"), a
     * project ID (such as "projects/my-project-id"), or a project number (such as
     * "projects/12345").
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $parent = '';
    /**
     * Required. The saved_query details. The `name` field must be empty as it
     * will be generated based on the parent and saved_query_id.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.SavedQuery saved_query = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $saved_query = null;
    /**
     * Required. The ID to use for the saved query, which must be unique in the
     * specified parent. It will become the final component of the saved query's
     * resource name.
     * This value should be 4-63 characters, and valid characters
     * are `[a-z][0-9]-`.
     * Notice that this field is required in the saved query creation, and the
     * `name` field of the `saved_query` will be ignored.
     *
     * Generated from protobuf field <code>string saved_query_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $saved_query_id = '';

    /**
     * @param string                            $parent       Required. The name of the project/folder/organization where this
     *                                                        saved_query should be created in. It can only be an organization number
     *                                                        (such as "organizations/123"), a folder number (such as "folders/123"), a
     *                                                        project ID (such as "projects/my-project-id"), or a project number (such as
     *                                                        "projects/12345"). Please see
     *                                                        {@see AssetServiceClient::projectName()} for help formatting this field.
     * @param \Google\Cloud\Asset\V1\SavedQuery $savedQuery   Required. The saved_query details. The `name` field must be empty as it
     *                                                        will be generated based on the parent and saved_query_id.
     * @param string                            $savedQueryId Required. The ID to use for the saved query, which must be unique in the
     *                                                        specified parent. It will become the final component of the saved query's
     *                                                        resource name.
     *
     *                                                        This value should be 4-63 characters, and valid characters
     *                                                        are `[a-z][0-9]-`.
     *
     *                                                        Notice that this field is required in the saved query creation, and the
     *                                                        `name` field of the `saved_query` will be ignored.
     *
     * @return \Google\Cloud\Asset\V1\CreateSavedQueryRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Cloud\Asset\V1\SavedQuery $savedQuery, string $savedQueryId): self
    {
        return (new self())
            ->setParent($parent)
            ->setSavedQuery($savedQuery)
            ->setSavedQueryId($savedQueryId);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The name of the project/folder/organization where this
     *           saved_query should be created in. It can only be an organization number
     *           (such as "organizations/123"), a folder number (such as "folders/123"), a
     *           project ID (such as "projects/my-project-id"), or a project number (such as
     *           "projects/12345").
     *     @type \Google\Cloud\Asset\V1\SavedQuery $saved_query
     *           Required. The saved_query details. The `name` field must be empty as it
     *           will be generated based on the parent and saved_query_id.
     *     @type string $saved_query_id
     *           Required. The ID to use for the saved query, which must be unique in the
     *           specified parent. It will become the final component of the saved query's
     *           resource name.
     *           This value should be 4-63 characters, and valid characters
     *           are `[a-z][0-9]-`.
     *           Notice that this field is required in the saved query creation, and the
     *           `name` field of the `saved_query` will be ignored.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The name of the project/folder/organization where this
     * saved_query should be created in. It can only be an organization number
     * (such as "organizations/123"), a folder number (such as "folders/123"), a
     * project ID (such as "projects/my-project-id"), or a project number (such as
     * "projects/12345").
     *
     * 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. The name of the project/folder/organization where this
     * saved_query should be created in. It can only be an organization number
     * (such as "organizations/123"), a folder number (such as "folders/123"), a
     * project ID (such as "projects/my-project-id"), or a project number (such as
     * "projects/12345").
     *
     * 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 saved_query details. The `name` field must be empty as it
     * will be generated based on the parent and saved_query_id.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.SavedQuery saved_query = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Asset\V1\SavedQuery|null
     */
    public function getSavedQuery()
    {
        return $this->saved_query;
    }

    public function hasSavedQuery()
    {
        return isset($this->saved_query);
    }

    public function clearSavedQuery()
    {
        unset($this->saved_query);
    }

    /**
     * Required. The saved_query details. The `name` field must be empty as it
     * will be generated based on the parent and saved_query_id.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.SavedQuery saved_query = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Asset\V1\SavedQuery $var
     * @return $this
     */
    public function setSavedQuery($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\SavedQuery::class);
        $this->saved_query = $var;

        return $this;
    }

    /**
     * Required. The ID to use for the saved query, which must be unique in the
     * specified parent. It will become the final component of the saved query's
     * resource name.
     * This value should be 4-63 characters, and valid characters
     * are `[a-z][0-9]-`.
     * Notice that this field is required in the saved query creation, and the
     * `name` field of the `saved_query` will be ignored.
     *
     * Generated from protobuf field <code>string saved_query_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getSavedQueryId()
    {
        return $this->saved_query_id;
    }

    /**
     * Required. The ID to use for the saved query, which must be unique in the
     * specified parent. It will become the final component of the saved query's
     * resource name.
     * This value should be 4-63 characters, and valid characters
     * are `[a-z][0-9]-`.
     * Notice that this field is required in the saved query creation, and the
     * `name` field of the `saved_query` will be ignored.
     *
     * Generated from protobuf field <code>string saved_query_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setSavedQueryId($var)
    {
        GPBUtil::checkString($var, True);
        $this->saved_query_id = $var;

        return $this;
    }

}

