<?php

namespace CustomerManagement\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for ArrayOfVocabularyNameEnum ArrayType
 * @subpackage Arrays
 */
class ArrayOfVocabularyNameEnum extends AbstractStructArrayBase
{
    /**
     * The VocabularyNameEnum
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var string[]
     */
    public $VocabularyNameEnum;
    /**
     * Constructor method for ArrayOfVocabularyNameEnum
     * @uses ArrayOfVocabularyNameEnum::setVocabularyNameEnum()
     * @param string[] $vocabularyNameEnum
     */
    public function __construct(array $vocabularyNameEnum = array())
    {
        $this
            ->setVocabularyNameEnum($vocabularyNameEnum);
    }
    /**
     * Get VocabularyNameEnum value
     * @return string[]|null
     */
    public function getVocabularyNameEnum()
    {
        return $this->VocabularyNameEnum;
    }
    /**
     * This method is responsible for validating the values passed to the setVocabularyNameEnum method
     * This method is willingly generated in order to preserve the one-line inline validation within the setVocabularyNameEnum method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateVocabularyNameEnumForArrayConstraintsFromSetVocabularyNameEnum(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfVocabularyNameEnumVocabularyNameEnumItem) {
            // validation for constraint: enumeration
            if (!\CustomerManagement\EnumType\VocabularyNameEnum::valueIsValid($arrayOfVocabularyNameEnumVocabularyNameEnumItem)) {
                $invalidValues[] = is_object($arrayOfVocabularyNameEnumVocabularyNameEnumItem) ? get_class($arrayOfVocabularyNameEnumVocabularyNameEnumItem) : sprintf('%s(%s)', gettype($arrayOfVocabularyNameEnumVocabularyNameEnumItem), var_export($arrayOfVocabularyNameEnumVocabularyNameEnumItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\VocabularyNameEnum', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \CustomerManagement\EnumType\VocabularyNameEnum::getValidValues()));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set VocabularyNameEnum value
     * @uses \CustomerManagement\EnumType\VocabularyNameEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\VocabularyNameEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string[] $vocabularyNameEnum
     * @return \CustomerManagement\ArrayType\ArrayOfVocabularyNameEnum
     */
    public function setVocabularyNameEnum(array $vocabularyNameEnum = array())
    {
        // validation for constraint: array
        if ('' !== ($vocabularyNameEnumArrayErrorMessage = self::validateVocabularyNameEnumForArrayConstraintsFromSetVocabularyNameEnum($vocabularyNameEnum))) {
            throw new \InvalidArgumentException($vocabularyNameEnumArrayErrorMessage, __LINE__);
        }
        $this->VocabularyNameEnum = $vocabularyNameEnum;
        return $this;
    }
    /**
     * Add item to VocabularyNameEnum value
     * @uses \CustomerManagement\EnumType\VocabularyNameEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\VocabularyNameEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfVocabularyNameEnum
     */
    public function addToVocabularyNameEnum($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\VocabularyNameEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\VocabularyNameEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\VocabularyNameEnum::getValidValues())), __LINE__);
        }
        $this->VocabularyNameEnum[] = $item;
        return $this;
    }
    /**
     * Returns the current element
     * @see AbstractStructArrayBase::current()
     * @return string|null
     */
    public function current()
    {
        return parent::current();
    }
    /**
     * Returns the indexed element
     * @see AbstractStructArrayBase::item()
     * @param int $index
     * @return string|null
     */
    public function item($index)
    {
        return parent::item($index);
    }
    /**
     * Returns the first element
     * @see AbstractStructArrayBase::first()
     * @return string|null
     */
    public function first()
    {
        return parent::first();
    }
    /**
     * Returns the last element
     * @see AbstractStructArrayBase::last()
     * @return string|null
     */
    public function last()
    {
        return parent::last();
    }
    /**
     * Returns the element at the offset
     * @see AbstractStructArrayBase::offsetGet()
     * @param int $offset
     * @return string|null
     */
    public function offsetGet($offset)
    {
        return parent::offsetGet($offset);
    }
    /**
     * Add element to array
     * @see AbstractStructArrayBase::add()
     * @throws \InvalidArgumentException
     * @uses \CustomerManagement\EnumType\VocabularyNameEnum::valueIsValid()
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfVocabularyNameEnum
     */
    public function add($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\VocabularyNameEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\VocabularyNameEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\VocabularyNameEnum::getValidValues())), __LINE__);
        }
        return parent::add($item);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string VocabularyNameEnum
     */
    public function getAttributeName()
    {
        return 'VocabularyNameEnum';
    }
}
