<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for addCallStates StructType
 * @subpackage Structs
 */
class AddCallStates extends AbstractStructBase
{
    /**
     * The callState
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * @var XCallStateMember[]
     */
    public $callState;
    /**
     * Constructor method for addCallStates
     * @uses AddCallStates::setCallState()
     * @param XCallStateMember[] $callState
     */
    public function __construct(array $callState = array())
    {
        $this
            ->setCallState($callState);
    }
    /**
     * Get callState value
     * @return XCallStateMember[]|null
     */
    public function getCallState()
    {
        return $this->callState;
    }
    /**
     * Set callState value
     * @throws \InvalidArgumentException
     * @param XCallStateMember[] $callState
     * @return AddCallStates
     */
    public function setCallState(array $callState = array())
    {
        foreach ($callState as $addCallStatesCallStateItem) {
            // validation for constraint: itemType
            if (!$addCallStatesCallStateItem instanceof XCallStateMember) {
                throw new \InvalidArgumentException(sprintf('The callState property can only contain items of XCallStateMember, "%s" given', is_object($addCallStatesCallStateItem) ? get_class($addCallStatesCallStateItem) : gettype($addCallStatesCallStateItem)), __LINE__);
            }
        }
        $this->callState = $callState;
        return $this;
    }
    /**
     * Add item to callState value
     * @throws \InvalidArgumentException
     * @param XCallStateMember $item
     * @return AddCallStates
     */
    public function addToCallState(XCallStateMember $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XCallStateMember) {
            throw new \InvalidArgumentException(sprintf('The callState property can only contain items of XCallStateMember, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->callState[] = $item;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return AddCallStates
     */
    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__;
    }
}
