<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/merchant/products/v1/products_common.proto

namespace Google\Shopping\Merchant\Products\V1;

use UnexpectedValueException;

/**
 * Target [age group](https://support.google.com/merchants/answer/6324463) of
 * the item.
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.AgeGroup</code>
 */
class AgeGroup
{
    /**
     * Age group is not specified.
     *
     * Generated from protobuf enum <code>AGE_GROUP_UNSPECIFIED = 0;</code>
     */
    const AGE_GROUP_UNSPECIFIED = 0;
    /**
     * Teens or older.
     *
     * Generated from protobuf enum <code>ADULT = 1;</code>
     */
    const ADULT = 1;
    /**
     * 5-13 years old.
     *
     * Generated from protobuf enum <code>KIDS = 2;</code>
     */
    const KIDS = 2;
    /**
     * 1-5 years old.
     *
     * Generated from protobuf enum <code>TODDLER = 3;</code>
     */
    const TODDLER = 3;
    /**
     * 3-12 months old.
     *
     * Generated from protobuf enum <code>INFANT = 4;</code>
     */
    const INFANT = 4;
    /**
     * 0-3 months old.
     *
     * Generated from protobuf enum <code>NEWBORN = 5;</code>
     */
    const NEWBORN = 5;

    private static $valueToName = [
        self::AGE_GROUP_UNSPECIFIED => 'AGE_GROUP_UNSPECIFIED',
        self::ADULT => 'ADULT',
        self::KIDS => 'KIDS',
        self::TODDLER => 'TODDLER',
        self::INFANT => 'INFANT',
        self::NEWBORN => 'NEWBORN',
    ];

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

