<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for MerchandiseHierarchyNodeSearchRowBasic StructType
 * @subpackage Structs
 */
class MerchandiseHierarchyNodeSearchRowBasic extends SearchRowBasic
{
    /**
     * The description
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnStringField[]
     */
    public $description;
    /**
     * The externalId
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnSelectField[]
     */
    public $externalId;
    /**
     * The hierarchyLevel
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnSelectField[]
     */
    public $hierarchyLevel;
    /**
     * The hierarchyVersion
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnSelectField[]
     */
    public $hierarchyVersion;
    /**
     * The internalId
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnSelectField[]
     */
    public $internalId;
    /**
     * The name
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnStringField[]
     */
    public $name;
    /**
     * The parentNode
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnSelectField[]
     */
    public $parentNode;
    /**
     * Constructor method for MerchandiseHierarchyNodeSearchRowBasic
     * @uses MerchandiseHierarchyNodeSearchRowBasic::setDescription()
     * @uses MerchandiseHierarchyNodeSearchRowBasic::setExternalId()
     * @uses MerchandiseHierarchyNodeSearchRowBasic::setHierarchyLevel()
     * @uses MerchandiseHierarchyNodeSearchRowBasic::setHierarchyVersion()
     * @uses MerchandiseHierarchyNodeSearchRowBasic::setInternalId()
     * @uses MerchandiseHierarchyNodeSearchRowBasic::setName()
     * @uses MerchandiseHierarchyNodeSearchRowBasic::setParentNode()
     * @param \StructType\SearchColumnStringField[] $description
     * @param \StructType\SearchColumnSelectField[] $externalId
     * @param \StructType\SearchColumnSelectField[] $hierarchyLevel
     * @param \StructType\SearchColumnSelectField[] $hierarchyVersion
     * @param \StructType\SearchColumnSelectField[] $internalId
     * @param \StructType\SearchColumnStringField[] $name
     * @param \StructType\SearchColumnSelectField[] $parentNode
     */
    public function __construct(array $description = array(), array $externalId = array(), array $hierarchyLevel = array(), array $hierarchyVersion = array(), array $internalId = array(), array $name = array(), array $parentNode = array())
    {
        $this
            ->setDescription($description)
            ->setExternalId($externalId)
            ->setHierarchyLevel($hierarchyLevel)
            ->setHierarchyVersion($hierarchyVersion)
            ->setInternalId($internalId)
            ->setName($name)
            ->setParentNode($parentNode);
    }
    /**
     * Get description value
     * @return \StructType\SearchColumnStringField[]|null
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * This method is responsible for validating the values passed to the setDescription method
     * This method is willingly generated in order to preserve the one-line inline validation within the setDescription method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateDescriptionForArrayConstraintsFromSetDescription(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $merchandiseHierarchyNodeSearchRowBasicDescriptionItem) {
            // validation for constraint: itemType
            if (!$merchandiseHierarchyNodeSearchRowBasicDescriptionItem instanceof \StructType\SearchColumnStringField) {
                $invalidValues[] = is_object($merchandiseHierarchyNodeSearchRowBasicDescriptionItem) ? get_class($merchandiseHierarchyNodeSearchRowBasicDescriptionItem) : sprintf('%s(%s)', gettype($merchandiseHierarchyNodeSearchRowBasicDescriptionItem), var_export($merchandiseHierarchyNodeSearchRowBasicDescriptionItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The description property can only contain items of type \StructType\SearchColumnStringField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set description value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnStringField[] $description
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function setDescription(array $description = array())
    {
        // validation for constraint: array
        if ('' !== ($descriptionArrayErrorMessage = self::validateDescriptionForArrayConstraintsFromSetDescription($description))) {
            throw new \InvalidArgumentException($descriptionArrayErrorMessage, __LINE__);
        }
        $this->description = $description;
        return $this;
    }
    /**
     * Add item to description value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnStringField $item
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function addToDescription(\StructType\SearchColumnStringField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnStringField) {
            throw new \InvalidArgumentException(sprintf('The description property can only contain items of type \StructType\SearchColumnStringField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->description[] = $item;
        return $this;
    }
    /**
     * Get externalId value
     * @return \StructType\SearchColumnSelectField[]|null
     */
    public function getExternalId()
    {
        return $this->externalId;
    }
    /**
     * This method is responsible for validating the values passed to the setExternalId method
     * This method is willingly generated in order to preserve the one-line inline validation within the setExternalId method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateExternalIdForArrayConstraintsFromSetExternalId(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $merchandiseHierarchyNodeSearchRowBasicExternalIdItem) {
            // validation for constraint: itemType
            if (!$merchandiseHierarchyNodeSearchRowBasicExternalIdItem instanceof \StructType\SearchColumnSelectField) {
                $invalidValues[] = is_object($merchandiseHierarchyNodeSearchRowBasicExternalIdItem) ? get_class($merchandiseHierarchyNodeSearchRowBasicExternalIdItem) : sprintf('%s(%s)', gettype($merchandiseHierarchyNodeSearchRowBasicExternalIdItem), var_export($merchandiseHierarchyNodeSearchRowBasicExternalIdItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The externalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set externalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField[] $externalId
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function setExternalId(array $externalId = array())
    {
        // validation for constraint: array
        if ('' !== ($externalIdArrayErrorMessage = self::validateExternalIdForArrayConstraintsFromSetExternalId($externalId))) {
            throw new \InvalidArgumentException($externalIdArrayErrorMessage, __LINE__);
        }
        $this->externalId = $externalId;
        return $this;
    }
    /**
     * Add item to externalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField $item
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function addToExternalId(\StructType\SearchColumnSelectField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnSelectField) {
            throw new \InvalidArgumentException(sprintf('The externalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->externalId[] = $item;
        return $this;
    }
    /**
     * Get hierarchyLevel value
     * @return \StructType\SearchColumnSelectField[]|null
     */
    public function getHierarchyLevel()
    {
        return $this->hierarchyLevel;
    }
    /**
     * This method is responsible for validating the values passed to the setHierarchyLevel method
     * This method is willingly generated in order to preserve the one-line inline validation within the setHierarchyLevel method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateHierarchyLevelForArrayConstraintsFromSetHierarchyLevel(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $merchandiseHierarchyNodeSearchRowBasicHierarchyLevelItem) {
            // validation for constraint: itemType
            if (!$merchandiseHierarchyNodeSearchRowBasicHierarchyLevelItem instanceof \StructType\SearchColumnSelectField) {
                $invalidValues[] = is_object($merchandiseHierarchyNodeSearchRowBasicHierarchyLevelItem) ? get_class($merchandiseHierarchyNodeSearchRowBasicHierarchyLevelItem) : sprintf('%s(%s)', gettype($merchandiseHierarchyNodeSearchRowBasicHierarchyLevelItem), var_export($merchandiseHierarchyNodeSearchRowBasicHierarchyLevelItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The hierarchyLevel property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set hierarchyLevel value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField[] $hierarchyLevel
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function setHierarchyLevel(array $hierarchyLevel = array())
    {
        // validation for constraint: array
        if ('' !== ($hierarchyLevelArrayErrorMessage = self::validateHierarchyLevelForArrayConstraintsFromSetHierarchyLevel($hierarchyLevel))) {
            throw new \InvalidArgumentException($hierarchyLevelArrayErrorMessage, __LINE__);
        }
        $this->hierarchyLevel = $hierarchyLevel;
        return $this;
    }
    /**
     * Add item to hierarchyLevel value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField $item
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function addToHierarchyLevel(\StructType\SearchColumnSelectField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnSelectField) {
            throw new \InvalidArgumentException(sprintf('The hierarchyLevel property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->hierarchyLevel[] = $item;
        return $this;
    }
    /**
     * Get hierarchyVersion value
     * @return \StructType\SearchColumnSelectField[]|null
     */
    public function getHierarchyVersion()
    {
        return $this->hierarchyVersion;
    }
    /**
     * This method is responsible for validating the values passed to the setHierarchyVersion method
     * This method is willingly generated in order to preserve the one-line inline validation within the setHierarchyVersion method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateHierarchyVersionForArrayConstraintsFromSetHierarchyVersion(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $merchandiseHierarchyNodeSearchRowBasicHierarchyVersionItem) {
            // validation for constraint: itemType
            if (!$merchandiseHierarchyNodeSearchRowBasicHierarchyVersionItem instanceof \StructType\SearchColumnSelectField) {
                $invalidValues[] = is_object($merchandiseHierarchyNodeSearchRowBasicHierarchyVersionItem) ? get_class($merchandiseHierarchyNodeSearchRowBasicHierarchyVersionItem) : sprintf('%s(%s)', gettype($merchandiseHierarchyNodeSearchRowBasicHierarchyVersionItem), var_export($merchandiseHierarchyNodeSearchRowBasicHierarchyVersionItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The hierarchyVersion property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set hierarchyVersion value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField[] $hierarchyVersion
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function setHierarchyVersion(array $hierarchyVersion = array())
    {
        // validation for constraint: array
        if ('' !== ($hierarchyVersionArrayErrorMessage = self::validateHierarchyVersionForArrayConstraintsFromSetHierarchyVersion($hierarchyVersion))) {
            throw new \InvalidArgumentException($hierarchyVersionArrayErrorMessage, __LINE__);
        }
        $this->hierarchyVersion = $hierarchyVersion;
        return $this;
    }
    /**
     * Add item to hierarchyVersion value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField $item
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function addToHierarchyVersion(\StructType\SearchColumnSelectField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnSelectField) {
            throw new \InvalidArgumentException(sprintf('The hierarchyVersion property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->hierarchyVersion[] = $item;
        return $this;
    }
    /**
     * Get internalId value
     * @return \StructType\SearchColumnSelectField[]|null
     */
    public function getInternalId()
    {
        return $this->internalId;
    }
    /**
     * This method is responsible for validating the values passed to the setInternalId method
     * This method is willingly generated in order to preserve the one-line inline validation within the setInternalId method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateInternalIdForArrayConstraintsFromSetInternalId(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $merchandiseHierarchyNodeSearchRowBasicInternalIdItem) {
            // validation for constraint: itemType
            if (!$merchandiseHierarchyNodeSearchRowBasicInternalIdItem instanceof \StructType\SearchColumnSelectField) {
                $invalidValues[] = is_object($merchandiseHierarchyNodeSearchRowBasicInternalIdItem) ? get_class($merchandiseHierarchyNodeSearchRowBasicInternalIdItem) : sprintf('%s(%s)', gettype($merchandiseHierarchyNodeSearchRowBasicInternalIdItem), var_export($merchandiseHierarchyNodeSearchRowBasicInternalIdItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The internalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set internalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField[] $internalId
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function setInternalId(array $internalId = array())
    {
        // validation for constraint: array
        if ('' !== ($internalIdArrayErrorMessage = self::validateInternalIdForArrayConstraintsFromSetInternalId($internalId))) {
            throw new \InvalidArgumentException($internalIdArrayErrorMessage, __LINE__);
        }
        $this->internalId = $internalId;
        return $this;
    }
    /**
     * Add item to internalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField $item
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function addToInternalId(\StructType\SearchColumnSelectField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnSelectField) {
            throw new \InvalidArgumentException(sprintf('The internalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->internalId[] = $item;
        return $this;
    }
    /**
     * Get name value
     * @return \StructType\SearchColumnStringField[]|null
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * This method is responsible for validating the values passed to the setName method
     * This method is willingly generated in order to preserve the one-line inline validation within the setName method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateNameForArrayConstraintsFromSetName(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $merchandiseHierarchyNodeSearchRowBasicNameItem) {
            // validation for constraint: itemType
            if (!$merchandiseHierarchyNodeSearchRowBasicNameItem instanceof \StructType\SearchColumnStringField) {
                $invalidValues[] = is_object($merchandiseHierarchyNodeSearchRowBasicNameItem) ? get_class($merchandiseHierarchyNodeSearchRowBasicNameItem) : sprintf('%s(%s)', gettype($merchandiseHierarchyNodeSearchRowBasicNameItem), var_export($merchandiseHierarchyNodeSearchRowBasicNameItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The name property can only contain items of type \StructType\SearchColumnStringField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set name value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnStringField[] $name
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function setName(array $name = array())
    {
        // validation for constraint: array
        if ('' !== ($nameArrayErrorMessage = self::validateNameForArrayConstraintsFromSetName($name))) {
            throw new \InvalidArgumentException($nameArrayErrorMessage, __LINE__);
        }
        $this->name = $name;
        return $this;
    }
    /**
     * Add item to name value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnStringField $item
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function addToName(\StructType\SearchColumnStringField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnStringField) {
            throw new \InvalidArgumentException(sprintf('The name property can only contain items of type \StructType\SearchColumnStringField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->name[] = $item;
        return $this;
    }
    /**
     * Get parentNode value
     * @return \StructType\SearchColumnSelectField[]|null
     */
    public function getParentNode()
    {
        return $this->parentNode;
    }
    /**
     * This method is responsible for validating the values passed to the setParentNode method
     * This method is willingly generated in order to preserve the one-line inline validation within the setParentNode method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateParentNodeForArrayConstraintsFromSetParentNode(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $merchandiseHierarchyNodeSearchRowBasicParentNodeItem) {
            // validation for constraint: itemType
            if (!$merchandiseHierarchyNodeSearchRowBasicParentNodeItem instanceof \StructType\SearchColumnSelectField) {
                $invalidValues[] = is_object($merchandiseHierarchyNodeSearchRowBasicParentNodeItem) ? get_class($merchandiseHierarchyNodeSearchRowBasicParentNodeItem) : sprintf('%s(%s)', gettype($merchandiseHierarchyNodeSearchRowBasicParentNodeItem), var_export($merchandiseHierarchyNodeSearchRowBasicParentNodeItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The parentNode property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set parentNode value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField[] $parentNode
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function setParentNode(array $parentNode = array())
    {
        // validation for constraint: array
        if ('' !== ($parentNodeArrayErrorMessage = self::validateParentNodeForArrayConstraintsFromSetParentNode($parentNode))) {
            throw new \InvalidArgumentException($parentNodeArrayErrorMessage, __LINE__);
        }
        $this->parentNode = $parentNode;
        return $this;
    }
    /**
     * Add item to parentNode value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField $item
     * @return \StructType\MerchandiseHierarchyNodeSearchRowBasic
     */
    public function addToParentNode(\StructType\SearchColumnSelectField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnSelectField) {
            throw new \InvalidArgumentException(sprintf('The parentNode property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->parentNode[] = $item;
        return $this;
    }
}
