<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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