<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Resource_Pool_Hierarchy_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Resource Pool Hierarchy Data from Web Service.
 * @subpackage Structs
 */
class Resource_Pool_Hierarchy_Response_DataType extends AbstractStructBase
{
    /**
     * The Resource_Pool_Hierarchy
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Resource_Pool_HierarchyType[]
     */
    public $Resource_Pool_Hierarchy;
    /**
     * Constructor method for Resource_Pool_Hierarchy_Response_DataType
     * @uses Resource_Pool_Hierarchy_Response_DataType::setResource_Pool_Hierarchy()
     * @param \StructType\Resource_Pool_HierarchyType[] $resource_Pool_Hierarchy
     */
    public function __construct(array $resource_Pool_Hierarchy = array())
    {
        $this
            ->setResource_Pool_Hierarchy($resource_Pool_Hierarchy);
    }
    /**
     * Get Resource_Pool_Hierarchy value
     * @return \StructType\Resource_Pool_HierarchyType[]|null
     */
    public function getResource_Pool_Hierarchy()
    {
        return $this->Resource_Pool_Hierarchy;
    }
    /**
     * This method is responsible for validating the values passed to the setResource_Pool_Hierarchy method
     * This method is willingly generated in order to preserve the one-line inline validation within the setResource_Pool_Hierarchy method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateResource_Pool_HierarchyForArrayConstraintsFromSetResource_Pool_Hierarchy(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $resource_Pool_Hierarchy_Response_DataTypeResource_Pool_HierarchyItem) {
            // validation for constraint: itemType
            if (!$resource_Pool_Hierarchy_Response_DataTypeResource_Pool_HierarchyItem instanceof \StructType\Resource_Pool_HierarchyType) {
                $invalidValues[] = is_object($resource_Pool_Hierarchy_Response_DataTypeResource_Pool_HierarchyItem) ? get_class($resource_Pool_Hierarchy_Response_DataTypeResource_Pool_HierarchyItem) : sprintf('%s(%s)', gettype($resource_Pool_Hierarchy_Response_DataTypeResource_Pool_HierarchyItem), var_export($resource_Pool_Hierarchy_Response_DataTypeResource_Pool_HierarchyItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Resource_Pool_Hierarchy property can only contain items of type \StructType\Resource_Pool_HierarchyType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Resource_Pool_Hierarchy value
     * @throws \InvalidArgumentException
     * @param \StructType\Resource_Pool_HierarchyType[] $resource_Pool_Hierarchy
     * @return \StructType\Resource_Pool_Hierarchy_Response_DataType
     */
    public function setResource_Pool_Hierarchy(array $resource_Pool_Hierarchy = array())
    {
        // validation for constraint: array
        if ('' !== ($resource_Pool_HierarchyArrayErrorMessage = self::validateResource_Pool_HierarchyForArrayConstraintsFromSetResource_Pool_Hierarchy($resource_Pool_Hierarchy))) {
            throw new \InvalidArgumentException($resource_Pool_HierarchyArrayErrorMessage, __LINE__);
        }
        $this->Resource_Pool_Hierarchy = $resource_Pool_Hierarchy;
        return $this;
    }
    /**
     * Add item to Resource_Pool_Hierarchy value
     * @throws \InvalidArgumentException
     * @param \StructType\Resource_Pool_HierarchyType $item
     * @return \StructType\Resource_Pool_Hierarchy_Response_DataType
     */
    public function addToResource_Pool_Hierarchy(\StructType\Resource_Pool_HierarchyType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Resource_Pool_HierarchyType) {
            throw new \InvalidArgumentException(sprintf('The Resource_Pool_Hierarchy property can only contain items of type \StructType\Resource_Pool_HierarchyType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Resource_Pool_Hierarchy[] = $item;
        return $this;
    }
}
