<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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