<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for OTA_AirRulesRQRuleReqInfo StructType
 * @package Dg
 * @subpackage Structs
 */
class DgOTA_AirRulesRQRuleReqInfo extends DgFareInfoType
{
    /**
     * The SubSection
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection[]
     */
    public $SubSection;
    /**
     * The LanguageRequested
     * @var string
     */
    public $LanguageRequested;
    /**
     * Constructor method for OTA_AirRulesRQRuleReqInfo
     * @uses DgOTA_AirRulesRQRuleReqInfo::setSubSection()
     * @uses DgOTA_AirRulesRQRuleReqInfo::setLanguageRequested()
     * @param \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection[] $subSection
     * @param string $languageRequested
     */
    public function __construct(array $subSection = array(), $languageRequested = null)
    {
        $this
            ->setSubSection($subSection)
            ->setLanguageRequested($languageRequested);
    }
    /**
     * Get SubSection value
     * @return \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection[]|null
     */
    public function getSubSection()
    {
        return $this->SubSection;
    }
    /**
     * Set SubSection value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection[] $subSection
     * @return \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfo
     */
    public function setSubSection(array $subSection = array())
    {
        foreach ($subSection as $oTA_AirRulesRQRuleReqInfoSubSectionItem) {
            // validation for constraint: itemType
            if (!$oTA_AirRulesRQRuleReqInfoSubSectionItem instanceof \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection) {
                throw new \InvalidArgumentException(sprintf('The SubSection property can only contain items of \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection, "%s" given', is_object($oTA_AirRulesRQRuleReqInfoSubSectionItem) ? get_class($oTA_AirRulesRQRuleReqInfoSubSectionItem) : gettype($oTA_AirRulesRQRuleReqInfoSubSectionItem)), __LINE__);
            }
        }
        $this->SubSection = $subSection;
        return $this;
    }
    /**
     * Add item to SubSection value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection $item
     * @return \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfo
     */
    public function addToSubSection(\dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection) {
            throw new \InvalidArgumentException(sprintf('The SubSection property can only contain items of \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfoSubSection, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->SubSection[] = $item;
        return $this;
    }
    /**
     * Get LanguageRequested value
     * @return string|null
     */
    public function getLanguageRequested()
    {
        return $this->LanguageRequested;
    }
    /**
     * Set LanguageRequested value
     * @param string $languageRequested
     * @return \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfo
     */
    public function setLanguageRequested($languageRequested = null)
    {
        // validation for constraint: string
        if (!is_null($languageRequested) && !is_string($languageRequested)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($languageRequested)), __LINE__);
        }
        $this->LanguageRequested = $languageRequested;
        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 \dgsoft\StructType\DgOTA_AirRulesRQRuleReqInfo
     */
    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__;
    }
}
