<?php

declare(strict_types=1);

namespace Drupal\netforum\xWeb\Generated\StructType;

use InvalidArgumentException;
use WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Exhibitor_BoothCollectionType StructType
 * @subpackage Structs
 * @author Drupal NetForum xWeb PHP SDK Generator
 * @version 1.0.0
 * @license GPL-2.0-or-later https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * @see https://www.drupal.org/project/netforum
 * @generatedDate 2025-08-05
 * @generatedRelease Official
 * @generatedNetForumVersion 37
 */
#[\AllowDynamicProperties]
class Exhibitor_BoothCollectionType extends AbstractStructBase
{
    /**
     * The ExhibitorBoothNew
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType[]
     */
    protected ?array $ExhibitorBoothNew = null;
    /**
     * Constructor method for Exhibitor_BoothCollectionType
     * @uses Exhibitor_BoothCollectionType::setExhibitorBoothNew()
     * @param \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType[] $exhibitorBoothNew
     */
    public function __construct(?array $exhibitorBoothNew = null)
    {
        $this
            ->setExhibitorBoothNew($exhibitorBoothNew);
    }
    /**
     * Get ExhibitorBoothNew value
     * @return \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType[]
     */
    public function getExhibitorBoothNew(): ?array
    {
        return $this->ExhibitorBoothNew;
    }
    /**
     * This method is responsible for validating the value(s) passed to the setExhibitorBoothNew method
     * This method is willingly generated in order to preserve the one-line inline validation within the setExhibitorBoothNew method
     * This has to validate that each item contained by the array match the itemType constraint
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateExhibitorBoothNewForArrayConstraintFromSetExhibitorBoothNew(?array $values = []): string
    {
        if (!is_array($values)) {
            return '';
        }
        $message = '';
        $invalidValues = [];
        foreach ($values as $exhibitor_BoothCollectionTypeExhibitorBoothNewItem) {
            // validation for constraint: itemType
            if (!$exhibitor_BoothCollectionTypeExhibitorBoothNewItem instanceof \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType) {
                $invalidValues[] = is_object($exhibitor_BoothCollectionTypeExhibitorBoothNewItem) ? get_class($exhibitor_BoothCollectionTypeExhibitorBoothNewItem) : sprintf('%s(%s)', gettype($exhibitor_BoothCollectionTypeExhibitorBoothNewItem), var_export($exhibitor_BoothCollectionTypeExhibitorBoothNewItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The ExhibitorBoothNew property can only contain items of type \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        
        return $message;
    }
    /**
     * Set ExhibitorBoothNew value
     * @throws InvalidArgumentException
     * @param \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType[] $exhibitorBoothNew
     * @return \Drupal\netforum\xWeb\Generated\StructType\Exhibitor_BoothCollectionType
     */
    public function setExhibitorBoothNew(?array $exhibitorBoothNew = null): self
    {
        // validation for constraint: array
        if ('' !== ($exhibitorBoothNewArrayErrorMessage = self::validateExhibitorBoothNewForArrayConstraintFromSetExhibitorBoothNew($exhibitorBoothNew))) {
            throw new InvalidArgumentException($exhibitorBoothNewArrayErrorMessage, __LINE__);
        }
        $this->ExhibitorBoothNew = $exhibitorBoothNew;
        
        return $this;
    }
    /**
     * Add item to ExhibitorBoothNew value
     * @throws InvalidArgumentException
     * @param \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType $item
     * @return \Drupal\netforum\xWeb\Generated\StructType\Exhibitor_BoothCollectionType
     */
    public function addToExhibitorBoothNew(\Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType $item): self
    {
        // validation for constraint: itemType
        if (!$item instanceof \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType) {
            throw new InvalidArgumentException(sprintf('The ExhibitorBoothNew property can only contain items of type \Drupal\netforum\xWeb\Generated\StructType\ExhibitorBoothNewType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->ExhibitorBoothNew[] = $item;
        
        return $this;
    }
}
