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

namespace Google\Cloud\Security\PrivateCA\V1\CertificateExtensionConstraints;

use UnexpectedValueException;

/**
 * Describes well-known X.509 extensions that can appear in a
 * [Certificate][google.cloud.security.privateca.v1.Certificate], not
 * including the
 * [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames]
 * extension.
 *
 * Protobuf type <code>google.cloud.security.privateca.v1.CertificateExtensionConstraints.KnownCertificateExtension</code>
 */
class KnownCertificateExtension
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED = 0;</code>
     */
    const KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED = 0;
    /**
     * Refers to a certificate's Key Usage extension, as described in [RFC 5280
     * section 4.2.1.3](https://tools.ietf.org/html/rfc5280#section-4.2.1.3).
     * This corresponds to the
     * [KeyUsage.base_key_usage][google.cloud.security.privateca.v1.KeyUsage.base_key_usage]
     * field.
     *
     * Generated from protobuf enum <code>BASE_KEY_USAGE = 1;</code>
     */
    const BASE_KEY_USAGE = 1;
    /**
     * Refers to a certificate's Extended Key Usage extension, as described in
     * [RFC 5280
     * section 4.2.1.12](https://tools.ietf.org/html/rfc5280#section-4.2.1.12).
     * This corresponds to the
     * [KeyUsage.extended_key_usage][google.cloud.security.privateca.v1.KeyUsage.extended_key_usage]
     * message.
     *
     * Generated from protobuf enum <code>EXTENDED_KEY_USAGE = 2;</code>
     */
    const EXTENDED_KEY_USAGE = 2;
    /**
     * Refers to a certificate's Basic Constraints extension, as described in
     * [RFC 5280
     * section 4.2.1.9](https://tools.ietf.org/html/rfc5280#section-4.2.1.9).
     * This corresponds to the
     * [X509Parameters.ca_options][google.cloud.security.privateca.v1.X509Parameters.ca_options]
     * field.
     *
     * Generated from protobuf enum <code>CA_OPTIONS = 3;</code>
     */
    const CA_OPTIONS = 3;
    /**
     * Refers to a certificate's Policy object identifiers, as described in
     * [RFC 5280
     * section 4.2.1.4](https://tools.ietf.org/html/rfc5280#section-4.2.1.4).
     * This corresponds to the
     * [X509Parameters.policy_ids][google.cloud.security.privateca.v1.X509Parameters.policy_ids]
     * field.
     *
     * Generated from protobuf enum <code>POLICY_IDS = 4;</code>
     */
    const POLICY_IDS = 4;
    /**
     * Refers to OCSP servers in a certificate's Authority Information Access
     * extension, as described in
     * [RFC 5280
     * section 4.2.2.1](https://tools.ietf.org/html/rfc5280#section-4.2.2.1),
     * This corresponds to the
     * [X509Parameters.aia_ocsp_servers][google.cloud.security.privateca.v1.X509Parameters.aia_ocsp_servers]
     * field.
     *
     * Generated from protobuf enum <code>AIA_OCSP_SERVERS = 5;</code>
     */
    const AIA_OCSP_SERVERS = 5;
    /**
     * Refers to Name Constraints extension as described in
     * [RFC 5280
     * section 4.2.1.10](https://tools.ietf.org/html/rfc5280#section-4.2.1.10)
     *
     * Generated from protobuf enum <code>NAME_CONSTRAINTS = 6;</code>
     */
    const NAME_CONSTRAINTS = 6;

    private static $valueToName = [
        self::KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED => 'KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED',
        self::BASE_KEY_USAGE => 'BASE_KEY_USAGE',
        self::EXTENDED_KEY_USAGE => 'EXTENDED_KEY_USAGE',
        self::CA_OPTIONS => 'CA_OPTIONS',
        self::POLICY_IDS => 'POLICY_IDS',
        self::AIA_OCSP_SERVERS => 'AIA_OCSP_SERVERS',
        self::NAME_CONSTRAINTS => 'NAME_CONSTRAINTS',
    ];

    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);
    }
}


