<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Travel_Profile_Request_ReferencesType StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing reference instances for Travel Profile
 * @subpackage Structs
 */
class Travel_Profile_Request_ReferencesType extends AbstractStructBase
{
    /**
     * The Travel_Profile_Reference
     * Meta information extracted from the WSDL
     * - documentation: Reference to an existing Travel Profile
     * - maxOccurs: unbounded
     * @var \StructType\Unique_IdentifierObjectType[]
     */
    public $Travel_Profile_Reference;
    /**
     * Constructor method for Travel_Profile_Request_ReferencesType
     * @uses Travel_Profile_Request_ReferencesType::setTravel_Profile_Reference()
     * @param \StructType\Unique_IdentifierObjectType[] $travel_Profile_Reference
     */
    public function __construct(array $travel_Profile_Reference = array())
    {
        $this
            ->setTravel_Profile_Reference($travel_Profile_Reference);
    }
    /**
     * Get Travel_Profile_Reference value
     * @return \StructType\Unique_IdentifierObjectType[]|null
     */
    public function getTravel_Profile_Reference()
    {
        return $this->Travel_Profile_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setTravel_Profile_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTravel_Profile_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTravel_Profile_ReferenceForArrayConstraintsFromSetTravel_Profile_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $travel_Profile_Request_ReferencesTypeTravel_Profile_ReferenceItem) {
            // validation for constraint: itemType
            if (!$travel_Profile_Request_ReferencesTypeTravel_Profile_ReferenceItem instanceof \StructType\Unique_IdentifierObjectType) {
                $invalidValues[] = is_object($travel_Profile_Request_ReferencesTypeTravel_Profile_ReferenceItem) ? get_class($travel_Profile_Request_ReferencesTypeTravel_Profile_ReferenceItem) : sprintf('%s(%s)', gettype($travel_Profile_Request_ReferencesTypeTravel_Profile_ReferenceItem), var_export($travel_Profile_Request_ReferencesTypeTravel_Profile_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Travel_Profile_Reference property can only contain items of type \StructType\Unique_IdentifierObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Travel_Profile_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Unique_IdentifierObjectType[] $travel_Profile_Reference
     * @return \StructType\Travel_Profile_Request_ReferencesType
     */
    public function setTravel_Profile_Reference(array $travel_Profile_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($travel_Profile_ReferenceArrayErrorMessage = self::validateTravel_Profile_ReferenceForArrayConstraintsFromSetTravel_Profile_Reference($travel_Profile_Reference))) {
            throw new \InvalidArgumentException($travel_Profile_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Travel_Profile_Reference = $travel_Profile_Reference;
        return $this;
    }
    /**
     * Add item to Travel_Profile_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Unique_IdentifierObjectType $item
     * @return \StructType\Travel_Profile_Request_ReferencesType
     */
    public function addToTravel_Profile_Reference(\StructType\Unique_IdentifierObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Unique_IdentifierObjectType) {
            throw new \InvalidArgumentException(sprintf('The Travel_Profile_Reference property can only contain items of type \StructType\Unique_IdentifierObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Travel_Profile_Reference[] = $item;
        return $this;
    }
}
