<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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