<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Travel_Booking_Record_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Wrapper element containing travel booking record response data for requested references or criteria and for requested response group
 * @subpackage Structs
 */
class Travel_Booking_Record_Response_DataType extends AbstractStructBase
{
    /**
     * The Travel_Booking_Record
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Travel_Booking_RecordType[]
     */
    public $Travel_Booking_Record;
    /**
     * Constructor method for Travel_Booking_Record_Response_DataType
     * @uses Travel_Booking_Record_Response_DataType::setTravel_Booking_Record()
     * @param \StructType\Travel_Booking_RecordType[] $travel_Booking_Record
     */
    public function __construct(array $travel_Booking_Record = array())
    {
        $this
            ->setTravel_Booking_Record($travel_Booking_Record);
    }
    /**
     * Get Travel_Booking_Record value
     * @return \StructType\Travel_Booking_RecordType[]|null
     */
    public function getTravel_Booking_Record()
    {
        return $this->Travel_Booking_Record;
    }
    /**
     * This method is responsible for validating the values passed to the setTravel_Booking_Record method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTravel_Booking_Record method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTravel_Booking_RecordForArrayConstraintsFromSetTravel_Booking_Record(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $travel_Booking_Record_Response_DataTypeTravel_Booking_RecordItem) {
            // validation for constraint: itemType
            if (!$travel_Booking_Record_Response_DataTypeTravel_Booking_RecordItem instanceof \StructType\Travel_Booking_RecordType) {
                $invalidValues[] = is_object($travel_Booking_Record_Response_DataTypeTravel_Booking_RecordItem) ? get_class($travel_Booking_Record_Response_DataTypeTravel_Booking_RecordItem) : sprintf('%s(%s)', gettype($travel_Booking_Record_Response_DataTypeTravel_Booking_RecordItem), var_export($travel_Booking_Record_Response_DataTypeTravel_Booking_RecordItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Travel_Booking_Record property can only contain items of type \StructType\Travel_Booking_RecordType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Travel_Booking_Record value
     * @throws \InvalidArgumentException
     * @param \StructType\Travel_Booking_RecordType[] $travel_Booking_Record
     * @return \StructType\Travel_Booking_Record_Response_DataType
     */
    public function setTravel_Booking_Record(array $travel_Booking_Record = array())
    {
        // validation for constraint: array
        if ('' !== ($travel_Booking_RecordArrayErrorMessage = self::validateTravel_Booking_RecordForArrayConstraintsFromSetTravel_Booking_Record($travel_Booking_Record))) {
            throw new \InvalidArgumentException($travel_Booking_RecordArrayErrorMessage, __LINE__);
        }
        $this->Travel_Booking_Record = $travel_Booking_Record;
        return $this;
    }
    /**
     * Add item to Travel_Booking_Record value
     * @throws \InvalidArgumentException
     * @param \StructType\Travel_Booking_RecordType $item
     * @return \StructType\Travel_Booking_Record_Response_DataType
     */
    public function addToTravel_Booking_Record(\StructType\Travel_Booking_RecordType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Travel_Booking_RecordType) {
            throw new \InvalidArgumentException(sprintf('The Travel_Booking_Record property can only contain items of type \StructType\Travel_Booking_RecordType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Travel_Booking_Record[] = $item;
        return $this;
    }
}
