<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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