<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for EstimatedTimetableDeliveriesStructure StructType
 * Meta informations extracted from the WSDL
 * - documentation: Type for Deliveries for Real-time Timetable Service. Used in WSDL.
 * @subpackage Structs
 */
class EstimatedTimetableDeliveriesStructure extends AbstractStructBase
{
    /**
     * The EstimatedTimetableDelivery
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - ref: EstimatedTimetableDelivery
     * @var \StructType\EstimatedTimetableDeliveryStructure[]
     */
    public $EstimatedTimetableDelivery;
    /**
     * Constructor method for EstimatedTimetableDeliveriesStructure
     * @uses EstimatedTimetableDeliveriesStructure::setEstimatedTimetableDelivery()
     * @param \StructType\EstimatedTimetableDeliveryStructure[] $estimatedTimetableDelivery
     */
    public function __construct(array $estimatedTimetableDelivery = array())
    {
        $this
            ->setEstimatedTimetableDelivery($estimatedTimetableDelivery);
    }
    /**
     * Get EstimatedTimetableDelivery value
     * @return \StructType\EstimatedTimetableDeliveryStructure[]|null
     */
    public function getEstimatedTimetableDelivery()
    {
        return $this->EstimatedTimetableDelivery;
    }
    /**
     * Set EstimatedTimetableDelivery value
     * @throws \InvalidArgumentException
     * @param \StructType\EstimatedTimetableDeliveryStructure[] $estimatedTimetableDelivery
     * @return \StructType\EstimatedTimetableDeliveriesStructure
     */
    public function setEstimatedTimetableDelivery(array $estimatedTimetableDelivery = array())
    {
        foreach ($estimatedTimetableDelivery as $estimatedTimetableDeliveriesStructureEstimatedTimetableDeliveryItem) {
            // validation for constraint: itemType
            if (!$estimatedTimetableDeliveriesStructureEstimatedTimetableDeliveryItem instanceof \StructType\EstimatedTimetableDeliveryStructure) {
                throw new \InvalidArgumentException(sprintf('The EstimatedTimetableDelivery property can only contain items of \StructType\EstimatedTimetableDeliveryStructure, "%s" given', is_object($estimatedTimetableDeliveriesStructureEstimatedTimetableDeliveryItem) ? get_class($estimatedTimetableDeliveriesStructureEstimatedTimetableDeliveryItem) : gettype($estimatedTimetableDeliveriesStructureEstimatedTimetableDeliveryItem)), __LINE__);
            }
        }
        $this->EstimatedTimetableDelivery = $estimatedTimetableDelivery;
        return $this;
    }
    /**
     * Add item to EstimatedTimetableDelivery value
     * @throws \InvalidArgumentException
     * @param \StructType\EstimatedTimetableDeliveryStructure $item
     * @return \StructType\EstimatedTimetableDeliveriesStructure
     */
    public function addToEstimatedTimetableDelivery(\StructType\EstimatedTimetableDeliveryStructure $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\EstimatedTimetableDeliveryStructure) {
            throw new \InvalidArgumentException(sprintf('The EstimatedTimetableDelivery property can only contain items of \StructType\EstimatedTimetableDeliveryStructure, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->EstimatedTimetableDelivery[] = $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 \StructType\EstimatedTimetableDeliveriesStructure
     */
    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__;
    }
}
