<?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\Replica;

use UnexpectedValueException;

/**
 * Primary state of the replica. Set only for the primary replica.
 *
 * Protobuf type <code>google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.Replica.PrimaryState</code>
 */
class PrimaryState
{
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>PRIMARY_STATE_UNSPECIFIED = 0;</code>
     */
    const PRIMARY_STATE_UNSPECIFIED = 0;
    /**
     * The replica is the primary replica.
     *
     * Generated from protobuf enum <code>PRIMARY_REPLICA = 1;</code>
     */
    const PRIMARY_REPLICA = 1;

    private static $valueToName = [
        self::PRIMARY_STATE_UNSPECIFIED => 'PRIMARY_STATE_UNSPECIFIED',
        self::PRIMARY_REPLICA => 'PRIMARY_REPLICA',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}


