<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for OTA_AirScheduleRSAirItinerariesType StructType
 * @package Dg
 * @subpackage Structs
 */
class DgOTA_AirScheduleRSAirItinerariesType extends AbstractStructBase
{
    /**
     * The AirItinerary
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType[]
     */
    public $AirItinerary;
    /**
     * The MyProperty
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string
     */
    public $MyProperty;
    /**
     * Constructor method for OTA_AirScheduleRSAirItinerariesType
     * @uses DgOTA_AirScheduleRSAirItinerariesType::setAirItinerary()
     * @uses DgOTA_AirScheduleRSAirItinerariesType::setMyProperty()
     * @param \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType[] $airItinerary
     * @param string $myProperty
     */
    public function __construct(array $airItinerary = array(), $myProperty = null)
    {
        $this
            ->setAirItinerary($airItinerary)
            ->setMyProperty($myProperty);
    }
    /**
     * Get AirItinerary value
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType[]|null
     */
    public function getAirItinerary()
    {
        return $this->AirItinerary;
    }
    /**
     * Set AirItinerary value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType[] $airItinerary
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSAirItinerariesType
     */
    public function setAirItinerary(array $airItinerary = array())
    {
        foreach ($airItinerary as $oTA_AirScheduleRSAirItinerariesTypeAirItineraryItem) {
            // validation for constraint: itemType
            if (!$oTA_AirScheduleRSAirItinerariesTypeAirItineraryItem instanceof \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType) {
                throw new \InvalidArgumentException(sprintf('The AirItinerary property can only contain items of \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType, "%s" given', is_object($oTA_AirScheduleRSAirItinerariesTypeAirItineraryItem) ? get_class($oTA_AirScheduleRSAirItinerariesTypeAirItineraryItem) : gettype($oTA_AirScheduleRSAirItinerariesTypeAirItineraryItem)), __LINE__);
            }
        }
        $this->AirItinerary = $airItinerary;
        return $this;
    }
    /**
     * Add item to AirItinerary value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType $item
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSAirItinerariesType
     */
    public function addToAirItinerary(\dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType) {
            throw new \InvalidArgumentException(sprintf('The AirItinerary property can only contain items of \dgsoft\StructType\DgOTA_AirScheduleRSAirItineraryType, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->AirItinerary[] = $item;
        return $this;
    }
    /**
     * Get MyProperty value
     * @return string|null
     */
    public function getMyProperty()
    {
        return $this->MyProperty;
    }
    /**
     * Set MyProperty value
     * @param string $myProperty
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSAirItinerariesType
     */
    public function setMyProperty($myProperty = null)
    {
        // validation for constraint: string
        if (!is_null($myProperty) && !is_string($myProperty)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($myProperty)), __LINE__);
        }
        $this->MyProperty = $myProperty;
        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_AirScheduleRSAirItinerariesType
     */
    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__;
    }
}
