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

namespace Google\Cloud\AppEngine\V1\ResourceRecord;

use UnexpectedValueException;

/**
 * A resource record type.
 *
 * Protobuf type <code>google.appengine.v1.ResourceRecord.RecordType</code>
 */
class RecordType
{
    /**
     * An unknown resource record.
     *
     * Generated from protobuf enum <code>RECORD_TYPE_UNSPECIFIED = 0;</code>
     */
    const RECORD_TYPE_UNSPECIFIED = 0;
    /**
     * An A resource record. Data is an IPv4 address.
     *
     * Generated from protobuf enum <code>A = 1;</code>
     */
    const A = 1;
    /**
     * An AAAA resource record. Data is an IPv6 address.
     *
     * Generated from protobuf enum <code>AAAA = 2;</code>
     */
    const AAAA = 2;
    /**
     * A CNAME resource record. Data is a domain name to be aliased.
     *
     * Generated from protobuf enum <code>CNAME = 3;</code>
     */
    const CNAME = 3;

    private static $valueToName = [
        self::RECORD_TYPE_UNSPECIFIED => 'RECORD_TYPE_UNSPECIFIED',
        self::A => 'A',
        self::AAAA => 'AAAA',
        self::CNAME => 'CNAME',
    ];

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


