<?php

namespace CustomerManagement\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for ArrayOfDeviceTypeEnum ArrayType
 * @subpackage Arrays
 */
class ArrayOfDeviceTypeEnum extends AbstractStructArrayBase
{
    /**
     * The DeviceTypeEnum
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var string[]
     */
    public $DeviceTypeEnum;
    /**
     * Constructor method for ArrayOfDeviceTypeEnum
     * @uses ArrayOfDeviceTypeEnum::setDeviceTypeEnum()
     * @param string[] $deviceTypeEnum
     */
    public function __construct(array $deviceTypeEnum = array())
    {
        $this
            ->setDeviceTypeEnum($deviceTypeEnum);
    }
    /**
     * Get DeviceTypeEnum value
     * @return string[]|null
     */
    public function getDeviceTypeEnum()
    {
        return $this->DeviceTypeEnum;
    }
    /**
     * This method is responsible for validating the values passed to the setDeviceTypeEnum method
     * This method is willingly generated in order to preserve the one-line inline validation within the setDeviceTypeEnum method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateDeviceTypeEnumForArrayConstraintsFromSetDeviceTypeEnum(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfDeviceTypeEnumDeviceTypeEnumItem) {
            // validation for constraint: enumeration
            if (!\CustomerManagement\EnumType\DeviceTypeEnum::valueIsValid($arrayOfDeviceTypeEnumDeviceTypeEnumItem)) {
                $invalidValues[] = is_object($arrayOfDeviceTypeEnumDeviceTypeEnumItem) ? get_class($arrayOfDeviceTypeEnumDeviceTypeEnumItem) : sprintf('%s(%s)', gettype($arrayOfDeviceTypeEnumDeviceTypeEnumItem), var_export($arrayOfDeviceTypeEnumDeviceTypeEnumItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\DeviceTypeEnum', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \CustomerManagement\EnumType\DeviceTypeEnum::getValidValues()));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set DeviceTypeEnum value
     * @uses \CustomerManagement\EnumType\DeviceTypeEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\DeviceTypeEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string[] $deviceTypeEnum
     * @return \CustomerManagement\ArrayType\ArrayOfDeviceTypeEnum
     */
    public function setDeviceTypeEnum(array $deviceTypeEnum = array())
    {
        // validation for constraint: array
        if ('' !== ($deviceTypeEnumArrayErrorMessage = self::validateDeviceTypeEnumForArrayConstraintsFromSetDeviceTypeEnum($deviceTypeEnum))) {
            throw new \InvalidArgumentException($deviceTypeEnumArrayErrorMessage, __LINE__);
        }
        $this->DeviceTypeEnum = $deviceTypeEnum;
        return $this;
    }
    /**
     * Add item to DeviceTypeEnum value
     * @uses \CustomerManagement\EnumType\DeviceTypeEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\DeviceTypeEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfDeviceTypeEnum
     */
    public function addToDeviceTypeEnum($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\DeviceTypeEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\DeviceTypeEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\DeviceTypeEnum::getValidValues())), __LINE__);
        }
        $this->DeviceTypeEnum[] = $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\DeviceTypeEnum::valueIsValid()
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfDeviceTypeEnum
     */
    public function add($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\DeviceTypeEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\DeviceTypeEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\DeviceTypeEnum::getValidValues())), __LINE__);
        }
        return parent::add($item);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string DeviceTypeEnum
     */
    public function getAttributeName()
    {
        return 'DeviceTypeEnum';
    }
}
