<?php

namespace patest\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for SinglePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7
 * StructType
 * Meta information extracted from the WSDL
 * - nillable: true
 * - type: tns:SinglePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7
 * @subpackage Structs
 */
class SinglePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7 extends SinglePropertyCriteriaBase
{
    /**
     * The Value
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * @var string[]
     */
    public $Value;
    /**
     * Constructor method for SinglePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7
     * @uses SinglePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7::setValue()
     * @param string[] $value
     */
    public function __construct(array $value = array())
    {
        $this
            ->setValue($value);
    }
    /**
     * Get Value value
     * @return string[]|null
     */
    public function getValue()
    {
        return $this->Value;
    }
    /**
     * This method is responsible for validating the values passed to the setValue method
     * This method is willingly generated in order to preserve the one-line inline validation within the setValue method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateValueForArrayConstraintsFromSetValue(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $singlePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7ValueItem) {
            // validation for constraint: enumeration
            if (!\patest\EnumType\DonationKindForSearch::valueIsValid($singlePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7ValueItem)) {
                $invalidValues[] = is_object($singlePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7ValueItem) ? get_class($singlePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7ValueItem) : sprintf('%s(%s)', gettype($singlePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7ValueItem), var_export($singlePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7ValueItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \patest\EnumType\DonationKindForSearch', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \patest\EnumType\DonationKindForSearch::getValidValues()));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Value value
     * @uses \patest\EnumType\DonationKindForSearch::valueIsValid()
     * @uses \patest\EnumType\DonationKindForSearch::getValidValues()
     * @throws \InvalidArgumentException
     * @param string[] $value
     * @return \patest\StructType\SinglePropertyCriteriaOfDonationKindForSearch8Q8HnG_P7
     */
    public function setValue(array $value = array())
    {
        // validation for constraint: list
        if ('' !== ($valueArrayErrorMessage = self::validateValueForArrayConstraintsFromSetValue($value))) {
            throw new \InvalidArgumentException($valueArrayErrorMessage, __LINE__);
        }
        $this->Value = is_array($value) ? implode(' ', $value) : null;
        return $this;
    }
}
