<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Internal_Catalog_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Wrapper element containing Internal Catalog response data for requested references.
 * @subpackage Structs
 */
class Internal_Catalog_Response_DataType extends AbstractStructBase
{
    /**
     * The Internal_Catalog
     * Meta information extracted from the WSDL
     * - documentation: Wrapper element for Internal Catalog Reference and Internal Catalog Data.
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Internal_CatalogType[]
     */
    public $Internal_Catalog;
    /**
     * Constructor method for Internal_Catalog_Response_DataType
     * @uses Internal_Catalog_Response_DataType::setInternal_Catalog()
     * @param \StructType\Internal_CatalogType[] $internal_Catalog
     */
    public function __construct(array $internal_Catalog = array())
    {
        $this
            ->setInternal_Catalog($internal_Catalog);
    }
    /**
     * Get Internal_Catalog value
     * @return \StructType\Internal_CatalogType[]|null
     */
    public function getInternal_Catalog()
    {
        return $this->Internal_Catalog;
    }
    /**
     * This method is responsible for validating the values passed to the setInternal_Catalog method
     * This method is willingly generated in order to preserve the one-line inline validation within the setInternal_Catalog method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateInternal_CatalogForArrayConstraintsFromSetInternal_Catalog(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $internal_Catalog_Response_DataTypeInternal_CatalogItem) {
            // validation for constraint: itemType
            if (!$internal_Catalog_Response_DataTypeInternal_CatalogItem instanceof \StructType\Internal_CatalogType) {
                $invalidValues[] = is_object($internal_Catalog_Response_DataTypeInternal_CatalogItem) ? get_class($internal_Catalog_Response_DataTypeInternal_CatalogItem) : sprintf('%s(%s)', gettype($internal_Catalog_Response_DataTypeInternal_CatalogItem), var_export($internal_Catalog_Response_DataTypeInternal_CatalogItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Internal_Catalog property can only contain items of type \StructType\Internal_CatalogType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Internal_Catalog value
     * @throws \InvalidArgumentException
     * @param \StructType\Internal_CatalogType[] $internal_Catalog
     * @return \StructType\Internal_Catalog_Response_DataType
     */
    public function setInternal_Catalog(array $internal_Catalog = array())
    {
        // validation for constraint: array
        if ('' !== ($internal_CatalogArrayErrorMessage = self::validateInternal_CatalogForArrayConstraintsFromSetInternal_Catalog($internal_Catalog))) {
            throw new \InvalidArgumentException($internal_CatalogArrayErrorMessage, __LINE__);
        }
        $this->Internal_Catalog = $internal_Catalog;
        return $this;
    }
    /**
     * Add item to Internal_Catalog value
     * @throws \InvalidArgumentException
     * @param \StructType\Internal_CatalogType $item
     * @return \StructType\Internal_Catalog_Response_DataType
     */
    public function addToInternal_Catalog(\StructType\Internal_CatalogType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Internal_CatalogType) {
            throw new \InvalidArgumentException(sprintf('The Internal_Catalog property can only contain items of type \StructType\Internal_CatalogType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Internal_Catalog[] = $item;
        return $this;
    }
}
