<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Catalog_Load_Request_ReferencesType StructType
 * Meta information extracted from the WSDL
 * - documentation: Catalog Load Request References
 * @subpackage Structs
 */
class Catalog_Load_Request_ReferencesType extends AbstractStructBase
{
    /**
     * The Catalog_Load_Reference
     * Meta information extracted from the WSDL
     * - documentation: Catalog Load Reference
     * - maxOccurs: unbounded
     * @var \StructType\Unique_IdentifierObjectType[]
     */
    public $Catalog_Load_Reference;
    /**
     * Constructor method for Catalog_Load_Request_ReferencesType
     * @uses Catalog_Load_Request_ReferencesType::setCatalog_Load_Reference()
     * @param \StructType\Unique_IdentifierObjectType[] $catalog_Load_Reference
     */
    public function __construct(array $catalog_Load_Reference = array())
    {
        $this
            ->setCatalog_Load_Reference($catalog_Load_Reference);
    }
    /**
     * Get Catalog_Load_Reference value
     * @return \StructType\Unique_IdentifierObjectType[]|null
     */
    public function getCatalog_Load_Reference()
    {
        return $this->Catalog_Load_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setCatalog_Load_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setCatalog_Load_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateCatalog_Load_ReferenceForArrayConstraintsFromSetCatalog_Load_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $catalog_Load_Request_ReferencesTypeCatalog_Load_ReferenceItem) {
            // validation for constraint: itemType
            if (!$catalog_Load_Request_ReferencesTypeCatalog_Load_ReferenceItem instanceof \StructType\Unique_IdentifierObjectType) {
                $invalidValues[] = is_object($catalog_Load_Request_ReferencesTypeCatalog_Load_ReferenceItem) ? get_class($catalog_Load_Request_ReferencesTypeCatalog_Load_ReferenceItem) : sprintf('%s(%s)', gettype($catalog_Load_Request_ReferencesTypeCatalog_Load_ReferenceItem), var_export($catalog_Load_Request_ReferencesTypeCatalog_Load_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Catalog_Load_Reference property can only contain items of type \StructType\Unique_IdentifierObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Catalog_Load_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Unique_IdentifierObjectType[] $catalog_Load_Reference
     * @return \StructType\Catalog_Load_Request_ReferencesType
     */
    public function setCatalog_Load_Reference(array $catalog_Load_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($catalog_Load_ReferenceArrayErrorMessage = self::validateCatalog_Load_ReferenceForArrayConstraintsFromSetCatalog_Load_Reference($catalog_Load_Reference))) {
            throw new \InvalidArgumentException($catalog_Load_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Catalog_Load_Reference = $catalog_Load_Reference;
        return $this;
    }
    /**
     * Add item to Catalog_Load_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Unique_IdentifierObjectType $item
     * @return \StructType\Catalog_Load_Request_ReferencesType
     */
    public function addToCatalog_Load_Reference(\StructType\Unique_IdentifierObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Unique_IdentifierObjectType) {
            throw new \InvalidArgumentException(sprintf('The Catalog_Load_Reference property can only contain items of type \StructType\Unique_IdentifierObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Catalog_Load_Reference[] = $item;
        return $this;
    }
}
