<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for
 * OTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption StructType
 * @package Dg
 * @subpackage Structs
 */
class DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption extends AbstractStructBase
{
    /**
     * The TimeTableAvailableDates
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgAvailableDate
     */
    public $TimeTableAvailableDates;
    /**
     * The FlightSegment
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment[]
     */
    public $FlightSegment;
    /**
     * The Comment
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgFreeTextType[]
     */
    public $Comment;
    /**
     * Constructor method for
     * OTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption
     * @uses DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption::setTimeTableAvailableDates()
     * @uses DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption::setFlightSegment()
     * @uses DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption::setComment()
     * @param \dgsoft\StructType\DgAvailableDate $timeTableAvailableDates
     * @param \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment[] $flightSegment
     * @param \dgsoft\StructType\DgFreeTextType[] $comment
     */
    public function __construct(\dgsoft\StructType\DgAvailableDate $timeTableAvailableDates = null, array $flightSegment = array(), array $comment = array())
    {
        $this
            ->setTimeTableAvailableDates($timeTableAvailableDates)
            ->setFlightSegment($flightSegment)
            ->setComment($comment);
    }
    /**
     * Get TimeTableAvailableDates value
     * @return \dgsoft\StructType\DgAvailableDate|null
     */
    public function getTimeTableAvailableDates()
    {
        return $this->TimeTableAvailableDates;
    }
    /**
     * Set TimeTableAvailableDates value
     * @param \dgsoft\StructType\DgAvailableDate $timeTableAvailableDates
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption
     */
    public function setTimeTableAvailableDates(\dgsoft\StructType\DgAvailableDate $timeTableAvailableDates = null)
    {
        $this->TimeTableAvailableDates = $timeTableAvailableDates;
        return $this;
    }
    /**
     * Get FlightSegment value
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment[]|null
     */
    public function getFlightSegment()
    {
        return $this->FlightSegment;
    }
    /**
     * Set FlightSegment value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment[] $flightSegment
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption
     */
    public function setFlightSegment(array $flightSegment = array())
    {
        foreach ($flightSegment as $oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegmentItem) {
            // validation for constraint: itemType
            if (!$oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegmentItem instanceof \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment) {
                throw new \InvalidArgumentException(sprintf('The FlightSegment property can only contain items of \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment, "%s" given', is_object($oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegmentItem) ? get_class($oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegmentItem) : gettype($oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegmentItem)), __LINE__);
            }
        }
        $this->FlightSegment = $flightSegment;
        return $this;
    }
    /**
     * Add item to FlightSegment value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment $item
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption
     */
    public function addToFlightSegment(\dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment) {
            throw new \InvalidArgumentException(sprintf('The FlightSegment property can only contain items of \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionFlightSegment, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->FlightSegment[] = $item;
        return $this;
    }
    /**
     * Get Comment value
     * @return \dgsoft\StructType\DgFreeTextType[]|null
     */
    public function getComment()
    {
        return $this->Comment;
    }
    /**
     * Set Comment value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgFreeTextType[] $comment
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption
     */
    public function setComment(array $comment = array())
    {
        foreach ($comment as $oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionCommentItem) {
            // validation for constraint: itemType
            if (!$oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionCommentItem instanceof \dgsoft\StructType\DgFreeTextType) {
                throw new \InvalidArgumentException(sprintf('The Comment property can only contain items of \dgsoft\StructType\DgFreeTextType, "%s" given', is_object($oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionCommentItem) ? get_class($oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionCommentItem) : gettype($oTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOptionCommentItem)), __LINE__);
            }
        }
        $this->Comment = $comment;
        return $this;
    }
    /**
     * Add item to Comment value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgFreeTextType $item
     * @return \dgsoft\StructType\DgOTA_AirScheduleRSOriginDestinationOptionsOriginDestinationOption
     */
    public function addToComment(\dgsoft\StructType\DgFreeTextType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgFreeTextType) {
            throw new \InvalidArgumentException(sprintf('The Comment property can only contain items of \dgsoft\StructType\DgFreeTextType, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->Comment[] = $item;
        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_AirScheduleRSOriginDestinationOptionsOriginDestinationOption
     */
    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__;
    }
}
