<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for JP_HotelFutureRatesResults StructType
 * @subpackage Structs
 */
class JP_HotelFutureRatesResults extends AbstractStructBase
{
    /**
     * The HotelFutureRatesResult
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\JP_HotelFutureRatesResult[]
     */
    public $HotelFutureRatesResult;
    /**
     * The WarningDetails
     * Meta information extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \StructType\JP_WarningDetails
     */
    public $WarningDetails;
    /**
     * Constructor method for JP_HotelFutureRatesResults
     * @uses JP_HotelFutureRatesResults::setHotelFutureRatesResult()
     * @uses JP_HotelFutureRatesResults::setWarningDetails()
     * @param \StructType\JP_HotelFutureRatesResult[] $hotelFutureRatesResult
     * @param \StructType\JP_WarningDetails $warningDetails
     */
    public function __construct(array $hotelFutureRatesResult = array(), \StructType\JP_WarningDetails $warningDetails = null)
    {
        $this
            ->setHotelFutureRatesResult($hotelFutureRatesResult)
            ->setWarningDetails($warningDetails);
    }
    /**
     * Get HotelFutureRatesResult value
     * @return \StructType\JP_HotelFutureRatesResult[]|null
     */
    public function getHotelFutureRatesResult()
    {
        return $this->HotelFutureRatesResult;
    }
    /**
     * This method is responsible for validating the values passed to the setHotelFutureRatesResult method
     * This method is willingly generated in order to preserve the one-line inline validation within the setHotelFutureRatesResult method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateHotelFutureRatesResultForArrayConstraintsFromSetHotelFutureRatesResult(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $jP_HotelFutureRatesResultsHotelFutureRatesResultItem) {
            // validation for constraint: itemType
            if (!$jP_HotelFutureRatesResultsHotelFutureRatesResultItem instanceof \StructType\JP_HotelFutureRatesResult) {
                $invalidValues[] = is_object($jP_HotelFutureRatesResultsHotelFutureRatesResultItem) ? get_class($jP_HotelFutureRatesResultsHotelFutureRatesResultItem) : sprintf('%s(%s)', gettype($jP_HotelFutureRatesResultsHotelFutureRatesResultItem), var_export($jP_HotelFutureRatesResultsHotelFutureRatesResultItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The HotelFutureRatesResult property can only contain items of type \StructType\JP_HotelFutureRatesResult, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set HotelFutureRatesResult value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_HotelFutureRatesResult[] $hotelFutureRatesResult
     * @return \StructType\JP_HotelFutureRatesResults
     */
    public function setHotelFutureRatesResult(array $hotelFutureRatesResult = array())
    {
        // validation for constraint: array
        if ('' !== ($hotelFutureRatesResultArrayErrorMessage = self::validateHotelFutureRatesResultForArrayConstraintsFromSetHotelFutureRatesResult($hotelFutureRatesResult))) {
            throw new \InvalidArgumentException($hotelFutureRatesResultArrayErrorMessage, __LINE__);
        }
        $this->HotelFutureRatesResult = $hotelFutureRatesResult;
        return $this;
    }
    /**
     * Add item to HotelFutureRatesResult value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_HotelFutureRatesResult $item
     * @return \StructType\JP_HotelFutureRatesResults
     */
    public function addToHotelFutureRatesResult(\StructType\JP_HotelFutureRatesResult $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\JP_HotelFutureRatesResult) {
            throw new \InvalidArgumentException(sprintf('The HotelFutureRatesResult property can only contain items of type \StructType\JP_HotelFutureRatesResult, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->HotelFutureRatesResult[] = $item;
        return $this;
    }
    /**
     * Get WarningDetails value
     * @return \StructType\JP_WarningDetails|null
     */
    public function getWarningDetails()
    {
        return $this->WarningDetails;
    }
    /**
     * Set WarningDetails value
     * @param \StructType\JP_WarningDetails $warningDetails
     * @return \StructType\JP_HotelFutureRatesResults
     */
    public function setWarningDetails(\StructType\JP_WarningDetails $warningDetails = null)
    {
        $this->WarningDetails = $warningDetails;
        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 \StructType\JP_HotelFutureRatesResults
     */
    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__;
    }
}
