<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Shared_Requisition_Template_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Wrapper Element that contains Requisition Template Instance and Data
 * @subpackage Structs
 */
class Shared_Requisition_Template_Response_DataType extends AbstractStructBase
{
    /**
     * The Requisition_Template
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Requisition_Template_WWSType[]
     */
    public $Requisition_Template;
    /**
     * Constructor method for Shared_Requisition_Template_Response_DataType
     * @uses Shared_Requisition_Template_Response_DataType::setRequisition_Template()
     * @param \StructType\Requisition_Template_WWSType[] $requisition_Template
     */
    public function __construct(array $requisition_Template = array())
    {
        $this
            ->setRequisition_Template($requisition_Template);
    }
    /**
     * Get Requisition_Template value
     * @return \StructType\Requisition_Template_WWSType[]|null
     */
    public function getRequisition_Template()
    {
        return $this->Requisition_Template;
    }
    /**
     * This method is responsible for validating the values passed to the setRequisition_Template method
     * This method is willingly generated in order to preserve the one-line inline validation within the setRequisition_Template method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateRequisition_TemplateForArrayConstraintsFromSetRequisition_Template(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $shared_Requisition_Template_Response_DataTypeRequisition_TemplateItem) {
            // validation for constraint: itemType
            if (!$shared_Requisition_Template_Response_DataTypeRequisition_TemplateItem instanceof \StructType\Requisition_Template_WWSType) {
                $invalidValues[] = is_object($shared_Requisition_Template_Response_DataTypeRequisition_TemplateItem) ? get_class($shared_Requisition_Template_Response_DataTypeRequisition_TemplateItem) : sprintf('%s(%s)', gettype($shared_Requisition_Template_Response_DataTypeRequisition_TemplateItem), var_export($shared_Requisition_Template_Response_DataTypeRequisition_TemplateItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Requisition_Template property can only contain items of type \StructType\Requisition_Template_WWSType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Requisition_Template value
     * @throws \InvalidArgumentException
     * @param \StructType\Requisition_Template_WWSType[] $requisition_Template
     * @return \StructType\Shared_Requisition_Template_Response_DataType
     */
    public function setRequisition_Template(array $requisition_Template = array())
    {
        // validation for constraint: array
        if ('' !== ($requisition_TemplateArrayErrorMessage = self::validateRequisition_TemplateForArrayConstraintsFromSetRequisition_Template($requisition_Template))) {
            throw new \InvalidArgumentException($requisition_TemplateArrayErrorMessage, __LINE__);
        }
        $this->Requisition_Template = $requisition_Template;
        return $this;
    }
    /**
     * Add item to Requisition_Template value
     * @throws \InvalidArgumentException
     * @param \StructType\Requisition_Template_WWSType $item
     * @return \StructType\Shared_Requisition_Template_Response_DataType
     */
    public function addToRequisition_Template(\StructType\Requisition_Template_WWSType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Requisition_Template_WWSType) {
            throw new \InvalidArgumentException(sprintf('The Requisition_Template property can only contain items of type \StructType\Requisition_Template_WWSType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Requisition_Template[] = $item;
        return $this;
    }
}
