<?php

namespace patest\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for UIPeer.ScreenParts.SearchFilter StructType
 * @subpackage Structs
 */
class UIPeer_ScreenParts_SearchFilter extends AnyEntity
{
    /**
     * The TargetEnum
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var string
     */
    public $TargetEnum;
    /**
     * Constructor method for UIPeer.ScreenParts.SearchFilter
     * @uses UIPeer_ScreenParts_SearchFilter::setTargetEnum()
     * @param string $targetEnum
     */
    public function __construct($targetEnum = null)
    {
        $this
            ->setTargetEnum($targetEnum);
    }
    /**
     * Get TargetEnum value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return string|null
     */
    public function getTargetEnum()
    {
        return isset($this->TargetEnum) ? $this->TargetEnum : null;
    }
    /**
     * Set TargetEnum value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @uses \patest\EnumType\SearchTargetEnum::valueIsValid()
     * @uses \patest\EnumType\SearchTargetEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $targetEnum
     * @return \patest\StructType\UIPeer_ScreenParts_SearchFilter
     */
    public function setTargetEnum($targetEnum = null)
    {
        // validation for constraint: enumeration
        if (!\patest\EnumType\SearchTargetEnum::valueIsValid($targetEnum)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \patest\EnumType\SearchTargetEnum', is_array($targetEnum) ? implode(', ', $targetEnum) : var_export($targetEnum, true), implode(', ', \patest\EnumType\SearchTargetEnum::getValidValues())), __LINE__);
        }
        if (is_null($targetEnum) || (is_array($targetEnum) && empty($targetEnum))) {
            unset($this->TargetEnum);
        } else {
            $this->TargetEnum = $targetEnum;
        }
        return $this;
    }
}
