<?php

namespace ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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