<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for ProductionTimetableDeliveriesStructure StructType
 * Meta informations extracted from the WSDL
 * - documentation: Type for deliveries of production timetable service. Used in WSDL.
 * @subpackage Structs
 */
class ProductionTimetableDeliveriesStructure extends AbstractStructBase
{
    /**
     * The ProductionTimetableDelivery
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - ref: ProductionTimetableDelivery
     * @var \StructType\ProductionTimetableDeliveryStructure[]
     */
    public $ProductionTimetableDelivery;
    /**
     * Constructor method for ProductionTimetableDeliveriesStructure
     * @uses ProductionTimetableDeliveriesStructure::setProductionTimetableDelivery()
     * @param \StructType\ProductionTimetableDeliveryStructure[] $productionTimetableDelivery
     */
    public function __construct(array $productionTimetableDelivery = array())
    {
        $this
            ->setProductionTimetableDelivery($productionTimetableDelivery);
    }
    /**
     * Get ProductionTimetableDelivery value
     * @return \StructType\ProductionTimetableDeliveryStructure[]|null
     */
    public function getProductionTimetableDelivery()
    {
        return $this->ProductionTimetableDelivery;
    }
    /**
     * Set ProductionTimetableDelivery value
     * @throws \InvalidArgumentException
     * @param \StructType\ProductionTimetableDeliveryStructure[] $productionTimetableDelivery
     * @return \StructType\ProductionTimetableDeliveriesStructure
     */
    public function setProductionTimetableDelivery(array $productionTimetableDelivery = array())
    {
        foreach ($productionTimetableDelivery as $productionTimetableDeliveriesStructureProductionTimetableDeliveryItem) {
            // validation for constraint: itemType
            if (!$productionTimetableDeliveriesStructureProductionTimetableDeliveryItem instanceof \StructType\ProductionTimetableDeliveryStructure) {
                throw new \InvalidArgumentException(sprintf('The ProductionTimetableDelivery property can only contain items of \StructType\ProductionTimetableDeliveryStructure, "%s" given', is_object($productionTimetableDeliveriesStructureProductionTimetableDeliveryItem) ? get_class($productionTimetableDeliveriesStructureProductionTimetableDeliveryItem) : gettype($productionTimetableDeliveriesStructureProductionTimetableDeliveryItem)), __LINE__);
            }
        }
        $this->ProductionTimetableDelivery = $productionTimetableDelivery;
        return $this;
    }
    /**
     * Add item to ProductionTimetableDelivery value
     * @throws \InvalidArgumentException
     * @param \StructType\ProductionTimetableDeliveryStructure $item
     * @return \StructType\ProductionTimetableDeliveriesStructure
     */
    public function addToProductionTimetableDelivery(\StructType\ProductionTimetableDeliveryStructure $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\ProductionTimetableDeliveryStructure) {
            throw new \InvalidArgumentException(sprintf('The ProductionTimetableDelivery property can only contain items of \StructType\ProductionTimetableDeliveryStructure, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->ProductionTimetableDelivery[] = $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\ProductionTimetableDeliveriesStructure
     */
    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__;
    }
}
