<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Asset_Pooling_Rule_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Response element for the Asset Pooling Rules operation
 * @subpackage Structs
 */
class Asset_Pooling_Rule_Response_DataType extends AbstractStructBase
{
    /**
     * The Asset_Pooling_Rule
     * Meta information extracted from the WSDL
     * - documentation: Element containing all Asset Pooling Rules
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Asset_Pooling_RuleType[]
     */
    public $Asset_Pooling_Rule;
    /**
     * Constructor method for Asset_Pooling_Rule_Response_DataType
     * @uses Asset_Pooling_Rule_Response_DataType::setAsset_Pooling_Rule()
     * @param \StructType\Asset_Pooling_RuleType[] $asset_Pooling_Rule
     */
    public function __construct(array $asset_Pooling_Rule = array())
    {
        $this
            ->setAsset_Pooling_Rule($asset_Pooling_Rule);
    }
    /**
     * Get Asset_Pooling_Rule value
     * @return \StructType\Asset_Pooling_RuleType[]|null
     */
    public function getAsset_Pooling_Rule()
    {
        return $this->Asset_Pooling_Rule;
    }
    /**
     * This method is responsible for validating the values passed to the setAsset_Pooling_Rule method
     * This method is willingly generated in order to preserve the one-line inline validation within the setAsset_Pooling_Rule method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateAsset_Pooling_RuleForArrayConstraintsFromSetAsset_Pooling_Rule(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $asset_Pooling_Rule_Response_DataTypeAsset_Pooling_RuleItem) {
            // validation for constraint: itemType
            if (!$asset_Pooling_Rule_Response_DataTypeAsset_Pooling_RuleItem instanceof \StructType\Asset_Pooling_RuleType) {
                $invalidValues[] = is_object($asset_Pooling_Rule_Response_DataTypeAsset_Pooling_RuleItem) ? get_class($asset_Pooling_Rule_Response_DataTypeAsset_Pooling_RuleItem) : sprintf('%s(%s)', gettype($asset_Pooling_Rule_Response_DataTypeAsset_Pooling_RuleItem), var_export($asset_Pooling_Rule_Response_DataTypeAsset_Pooling_RuleItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Asset_Pooling_Rule property can only contain items of type \StructType\Asset_Pooling_RuleType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Asset_Pooling_Rule value
     * @throws \InvalidArgumentException
     * @param \StructType\Asset_Pooling_RuleType[] $asset_Pooling_Rule
     * @return \StructType\Asset_Pooling_Rule_Response_DataType
     */
    public function setAsset_Pooling_Rule(array $asset_Pooling_Rule = array())
    {
        // validation for constraint: array
        if ('' !== ($asset_Pooling_RuleArrayErrorMessage = self::validateAsset_Pooling_RuleForArrayConstraintsFromSetAsset_Pooling_Rule($asset_Pooling_Rule))) {
            throw new \InvalidArgumentException($asset_Pooling_RuleArrayErrorMessage, __LINE__);
        }
        $this->Asset_Pooling_Rule = $asset_Pooling_Rule;
        return $this;
    }
    /**
     * Add item to Asset_Pooling_Rule value
     * @throws \InvalidArgumentException
     * @param \StructType\Asset_Pooling_RuleType $item
     * @return \StructType\Asset_Pooling_Rule_Response_DataType
     */
    public function addToAsset_Pooling_Rule(\StructType\Asset_Pooling_RuleType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Asset_Pooling_RuleType) {
            throw new \InvalidArgumentException(sprintf('The Asset_Pooling_Rule property can only contain items of type \StructType\Asset_Pooling_RuleType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Asset_Pooling_Rule[] = $item;
        return $this;
    }
}
