<?php

namespace CustomerManagement\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for ArrayOfTroubleConditionTypeEnum ArrayType
 * @subpackage Arrays
 */
class ArrayOfTroubleConditionTypeEnum extends AbstractStructArrayBase
{
    /**
     * The TroubleConditionTypeEnum
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var string[]
     */
    public $TroubleConditionTypeEnum;
    /**
     * Constructor method for ArrayOfTroubleConditionTypeEnum
     * @uses ArrayOfTroubleConditionTypeEnum::setTroubleConditionTypeEnum()
     * @param string[] $troubleConditionTypeEnum
     */
    public function __construct(array $troubleConditionTypeEnum = array())
    {
        $this
            ->setTroubleConditionTypeEnum($troubleConditionTypeEnum);
    }
    /**
     * Get TroubleConditionTypeEnum value
     * @return string[]|null
     */
    public function getTroubleConditionTypeEnum()
    {
        return $this->TroubleConditionTypeEnum;
    }
    /**
     * This method is responsible for validating the values passed to the setTroubleConditionTypeEnum method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTroubleConditionTypeEnum method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTroubleConditionTypeEnumForArrayConstraintsFromSetTroubleConditionTypeEnum(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfTroubleConditionTypeEnumTroubleConditionTypeEnumItem) {
            // validation for constraint: enumeration
            if (!\CustomerManagement\EnumType\TroubleConditionTypeEnum::valueIsValid($arrayOfTroubleConditionTypeEnumTroubleConditionTypeEnumItem)) {
                $invalidValues[] = is_object($arrayOfTroubleConditionTypeEnumTroubleConditionTypeEnumItem) ? get_class($arrayOfTroubleConditionTypeEnumTroubleConditionTypeEnumItem) : sprintf('%s(%s)', gettype($arrayOfTroubleConditionTypeEnumTroubleConditionTypeEnumItem), var_export($arrayOfTroubleConditionTypeEnumTroubleConditionTypeEnumItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\TroubleConditionTypeEnum', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \CustomerManagement\EnumType\TroubleConditionTypeEnum::getValidValues()));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set TroubleConditionTypeEnum value
     * @uses \CustomerManagement\EnumType\TroubleConditionTypeEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\TroubleConditionTypeEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string[] $troubleConditionTypeEnum
     * @return \CustomerManagement\ArrayType\ArrayOfTroubleConditionTypeEnum
     */
    public function setTroubleConditionTypeEnum(array $troubleConditionTypeEnum = array())
    {
        // validation for constraint: array
        if ('' !== ($troubleConditionTypeEnumArrayErrorMessage = self::validateTroubleConditionTypeEnumForArrayConstraintsFromSetTroubleConditionTypeEnum($troubleConditionTypeEnum))) {
            throw new \InvalidArgumentException($troubleConditionTypeEnumArrayErrorMessage, __LINE__);
        }
        $this->TroubleConditionTypeEnum = $troubleConditionTypeEnum;
        return $this;
    }
    /**
     * Add item to TroubleConditionTypeEnum value
     * @uses \CustomerManagement\EnumType\TroubleConditionTypeEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\TroubleConditionTypeEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfTroubleConditionTypeEnum
     */
    public function addToTroubleConditionTypeEnum($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\TroubleConditionTypeEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\TroubleConditionTypeEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\TroubleConditionTypeEnum::getValidValues())), __LINE__);
        }
        $this->TroubleConditionTypeEnum[] = $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\TroubleConditionTypeEnum::valueIsValid()
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfTroubleConditionTypeEnum
     */
    public function add($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\TroubleConditionTypeEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\TroubleConditionTypeEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\TroubleConditionTypeEnum::getValidValues())), __LINE__);
        }
        return parent::add($item);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string TroubleConditionTypeEnum
     */
    public function getAttributeName()
    {
        return 'TroubleConditionTypeEnum';
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructArrayBase::__set_state()
     * @uses AbstractStructArrayBase::__set_state()
     * @param array $array the exported values
     * @return \CustomerManagement\ArrayType\ArrayOfTroubleConditionTypeEnum
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
