<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Travel_Profile_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing the actual Travel Profiles data requested.It contains one element: Travel Profile, which in turn contains the instance set of Travel Profiles which are returned.
 * @subpackage Structs
 */
class Travel_Profile_Response_DataType extends AbstractStructBase
{
    /**
     * The Travel_Profile
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Travel_ProfileType[]
     */
    public $Travel_Profile;
    /**
     * Constructor method for Travel_Profile_Response_DataType
     * @uses Travel_Profile_Response_DataType::setTravel_Profile()
     * @param \StructType\Travel_ProfileType[] $travel_Profile
     */
    public function __construct(array $travel_Profile = array())
    {
        $this
            ->setTravel_Profile($travel_Profile);
    }
    /**
     * Get Travel_Profile value
     * @return \StructType\Travel_ProfileType[]|null
     */
    public function getTravel_Profile()
    {
        return $this->Travel_Profile;
    }
    /**
     * This method is responsible for validating the values passed to the setTravel_Profile method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTravel_Profile method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTravel_ProfileForArrayConstraintsFromSetTravel_Profile(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $travel_Profile_Response_DataTypeTravel_ProfileItem) {
            // validation for constraint: itemType
            if (!$travel_Profile_Response_DataTypeTravel_ProfileItem instanceof \StructType\Travel_ProfileType) {
                $invalidValues[] = is_object($travel_Profile_Response_DataTypeTravel_ProfileItem) ? get_class($travel_Profile_Response_DataTypeTravel_ProfileItem) : sprintf('%s(%s)', gettype($travel_Profile_Response_DataTypeTravel_ProfileItem), var_export($travel_Profile_Response_DataTypeTravel_ProfileItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Travel_Profile property can only contain items of type \StructType\Travel_ProfileType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Travel_Profile value
     * @throws \InvalidArgumentException
     * @param \StructType\Travel_ProfileType[] $travel_Profile
     * @return \StructType\Travel_Profile_Response_DataType
     */
    public function setTravel_Profile(array $travel_Profile = array())
    {
        // validation for constraint: array
        if ('' !== ($travel_ProfileArrayErrorMessage = self::validateTravel_ProfileForArrayConstraintsFromSetTravel_Profile($travel_Profile))) {
            throw new \InvalidArgumentException($travel_ProfileArrayErrorMessage, __LINE__);
        }
        $this->Travel_Profile = $travel_Profile;
        return $this;
    }
    /**
     * Add item to Travel_Profile value
     * @throws \InvalidArgumentException
     * @param \StructType\Travel_ProfileType $item
     * @return \StructType\Travel_Profile_Response_DataType
     */
    public function addToTravel_Profile(\StructType\Travel_ProfileType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Travel_ProfileType) {
            throw new \InvalidArgumentException(sprintf('The Travel_Profile property can only contain items of type \StructType\Travel_ProfileType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Travel_Profile[] = $item;
        return $this;
    }
}
