<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for subunit StructType
 * @subpackage Structs
 */
class Subunit extends AbstractStructBase
{
    /**
     * The index
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * - nillable: false
     * @var string
     */
    public $index;
    /**
     * The product
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * - nillable: true
     * @var string
     */
    public $product;
    /**
     * The beginPort
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * - nillable: true
     * @var string
     */
    public $beginPort;
    /**
     * Constructor method for subunit
     * @uses Subunit::setIndex()
     * @uses Subunit::setProduct()
     * @uses Subunit::setBeginPort()
     * @param string $index
     * @param string $product
     * @param string $beginPort
     */
    public function __construct($index = null, $product = null, $beginPort = null)
    {
        $this
            ->setIndex($index)
            ->setProduct($product)
            ->setBeginPort($beginPort);
    }
    /**
     * Get index value
     * @return string|null
     */
    public function getIndex()
    {
        return $this->index;
    }
    /**
     * Set index value
     * @uses XInteger::valueIsValid()
     * @uses XInteger::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $index
     * @return Subunit
     */
    public function setIndex($index = null)
    {
        // validation for constraint: enumeration
        if (!XInteger::valueIsValid($index)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $index, implode(', ', XInteger::getValidValues())), __LINE__);
        }
        $this->index = $index;
        return $this;
    }
    /**
     * Get product value
     * @return string|null
     */
    public function getProduct()
    {
        return $this->product;
    }
    /**
     * Set product value
     * @uses XMGCPVic::valueIsValid()
     * @uses XMGCPVic::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $product
     * @return Subunit
     */
    public function setProduct($product = null)
    {
        // validation for constraint: enumeration
        if (!XMGCPVic::valueIsValid($product)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $product, implode(', ', XMGCPVic::getValidValues())), __LINE__);
        }
        $this->product = $product;
        return $this;
    }
    /**
     * Get beginPort value
     * @return string|null
     */
    public function getBeginPort()
    {
        return $this->beginPort;
    }
    /**
     * Set beginPort value
     * @uses XInteger::valueIsValid()
     * @uses XInteger::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $beginPort
     * @return Subunit
     */
    public function setBeginPort($beginPort = null)
    {
        // validation for constraint: enumeration
        if (!XInteger::valueIsValid($beginPort)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $beginPort, implode(', ', XInteger::getValidValues())), __LINE__);
        }
        $this->beginPort = $beginPort;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return Subunit
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
