<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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