<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for endUsers StructType
 * Meta informations extracted from the WSDL
 * - documentation: Applicable for Cisco Unity Voice Mail 4.x or later, Cisco Unity Connection and Cisco Web Dialer | Applicable for Cisco Unity Voice Mail 4.x or later, Cisco Unity Connection and Cisco Web Dialer
 * @subpackage Structs
 */
class EndUsers extends XCommonMembersExtension
{
    /**
     * The selectedEndUser
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var SelectedEndUser[]
     */
    public $selectedEndUser;
    /**
     * Constructor method for endUsers
     * @uses EndUsers::setSelectedEndUser()
     * @param SelectedEndUser[] $selectedEndUser
     */
    public function __construct(array $selectedEndUser = array())
    {
        $this
            ->setSelectedEndUser($selectedEndUser);
    }
    /**
     * Get selectedEndUser value
     * @return SelectedEndUser[]|null
     */
    public function getSelectedEndUser()
    {
        return $this->selectedEndUser;
    }
    /**
     * Set selectedEndUser value
     * @throws \InvalidArgumentException
     * @param SelectedEndUser[] $selectedEndUser
     * @return EndUsers
     */
    public function setSelectedEndUser(array $selectedEndUser = array())
    {
        foreach ($selectedEndUser as $endUsersSelectedEndUserItem) {
            // validation for constraint: itemType
            if (!$endUsersSelectedEndUserItem instanceof SelectedEndUser) {
                throw new \InvalidArgumentException(sprintf('The selectedEndUser property can only contain items of SelectedEndUser, "%s" given', is_object($endUsersSelectedEndUserItem) ? get_class($endUsersSelectedEndUserItem) : gettype($endUsersSelectedEndUserItem)), __LINE__);
            }
        }
        $this->selectedEndUser = $selectedEndUser;
        return $this;
    }
    /**
     * Add item to selectedEndUser value
     * @throws \InvalidArgumentException
     * @param SelectedEndUser $item
     * @return EndUsers
     */
    public function addToSelectedEndUser(SelectedEndUser $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof SelectedEndUser) {
            throw new \InvalidArgumentException(sprintf('The selectedEndUser property can only contain items of SelectedEndUser, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->selectedEndUser[] = $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 EndUsers
     */
    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__;
    }
}
