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

namespace Google\Cloud\BigQuery\AnalyticsHub\V1\Listing\BigQueryDatasetSource;

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

/**
 * Represents the state of a replica of a shared dataset.
 * It includes the geographic location of the replica and
 * system-computed, output-only fields indicating its replication state and
 * whether it is the primary replica.
 *
 * Generated from protobuf message <code>google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica</code>
 */
class Replica extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The geographic location where the replica resides. See
     * [BigQuery locations](https://cloud.google.com/bigquery/docs/locations)
     * for supported locations. Eg. "us-central1".
     *
     * Generated from protobuf field <code>string location = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $location = '';
    /**
     * Output only. Assigned by Analytics Hub based on real BigQuery
     * replication state.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.ReplicaState replica_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $replica_state = 0;
    /**
     * Output only. Indicates that this replica is the primary replica.
     *
     * Generated from protobuf field <code>optional .google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.PrimaryState primary_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $primary_state = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $location
     *           Output only. The geographic location where the replica resides. See
     *           [BigQuery locations](https://cloud.google.com/bigquery/docs/locations)
     *           for supported locations. Eg. "us-central1".
     *     @type int $replica_state
     *           Output only. Assigned by Analytics Hub based on real BigQuery
     *           replication state.
     *     @type int $primary_state
     *           Output only. Indicates that this replica is the primary replica.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Bigquery\Analyticshub\V1\Analyticshub::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The geographic location where the replica resides. See
     * [BigQuery locations](https://cloud.google.com/bigquery/docs/locations)
     * for supported locations. Eg. "us-central1".
     *
     * Generated from protobuf field <code>string location = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     * Output only. The geographic location where the replica resides. See
     * [BigQuery locations](https://cloud.google.com/bigquery/docs/locations)
     * for supported locations. Eg. "us-central1".
     *
     * Generated from protobuf field <code>string location = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setLocation($var)
    {
        GPBUtil::checkString($var, True);
        $this->location = $var;

        return $this;
    }

    /**
     * Output only. Assigned by Analytics Hub based on real BigQuery
     * replication state.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.ReplicaState replica_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getReplicaState()
    {
        return $this->replica_state;
    }

    /**
     * Output only. Assigned by Analytics Hub based on real BigQuery
     * replication state.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.ReplicaState replica_state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setReplicaState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\AnalyticsHub\V1\Listing\BigQueryDatasetSource\Replica\ReplicaState::class);
        $this->replica_state = $var;

        return $this;
    }

    /**
     * Output only. Indicates that this replica is the primary replica.
     *
     * Generated from protobuf field <code>optional .google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.PrimaryState primary_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getPrimaryState()
    {
        return isset($this->primary_state) ? $this->primary_state : 0;
    }

    public function hasPrimaryState()
    {
        return isset($this->primary_state);
    }

    public function clearPrimaryState()
    {
        unset($this->primary_state);
    }

    /**
     * Output only. Indicates that this replica is the primary replica.
     *
     * Generated from protobuf field <code>optional .google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.PrimaryState primary_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setPrimaryState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\AnalyticsHub\V1\Listing\BigQueryDatasetSource\Replica\PrimaryState::class);
        $this->primary_state = $var;

        return $this;
    }

}


