<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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