<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for SpecialRequestChange StructType
 * @package Dg
 * @subpackage Structs
 */
class DgSpecialRequestChange extends AbstractStructBase
{
    /**
     * The SpecialReqDetails
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgSpecialReqDetailsType[]
     */
    public $SpecialReqDetails;
    /**
     * Constructor method for SpecialRequestChange
     * @uses DgSpecialRequestChange::setSpecialReqDetails()
     * @param \dgsoft\StructType\DgSpecialReqDetailsType[] $specialReqDetails
     */
    public function __construct(array $specialReqDetails = array())
    {
        $this
            ->setSpecialReqDetails($specialReqDetails);
    }
    /**
     * Get SpecialReqDetails value
     * @return \dgsoft\StructType\DgSpecialReqDetailsType[]|null
     */
    public function getSpecialReqDetails()
    {
        return $this->SpecialReqDetails;
    }
    /**
     * Set SpecialReqDetails value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgSpecialReqDetailsType[] $specialReqDetails
     * @return \dgsoft\StructType\DgSpecialRequestChange
     */
    public function setSpecialReqDetails(array $specialReqDetails = array())
    {
        foreach ($specialReqDetails as $specialRequestChangeSpecialReqDetailsItem) {
            // validation for constraint: itemType
            if (!$specialRequestChangeSpecialReqDetailsItem instanceof \dgsoft\StructType\DgSpecialReqDetailsType) {
                throw new \InvalidArgumentException(sprintf('The SpecialReqDetails property can only contain items of \dgsoft\StructType\DgSpecialReqDetailsType, "%s" given', is_object($specialRequestChangeSpecialReqDetailsItem) ? get_class($specialRequestChangeSpecialReqDetailsItem) : gettype($specialRequestChangeSpecialReqDetailsItem)), __LINE__);
            }
        }
        $this->SpecialReqDetails = $specialReqDetails;
        return $this;
    }
    /**
     * Add item to SpecialReqDetails value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgSpecialReqDetailsType $item
     * @return \dgsoft\StructType\DgSpecialRequestChange
     */
    public function addToSpecialReqDetails(\dgsoft\StructType\DgSpecialReqDetailsType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgSpecialReqDetailsType) {
            throw new \InvalidArgumentException(sprintf('The SpecialReqDetails property can only contain items of \dgsoft\StructType\DgSpecialReqDetailsType, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->SpecialReqDetails[] = $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 \dgsoft\StructType\DgSpecialRequestChange
     */
    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__;
    }
}
