<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Veteran_Status_Request_ReferencesType StructType
 * Meta information extracted from the WSDL
 * - documentation: Contains Veteran Status references.
 * @subpackage Structs
 */
class Veteran_Status_Request_ReferencesType extends AbstractStructBase
{
    /**
     * The Veteran_Status_Reference
     * Meta information extracted from the WSDL
     * - documentation: Veteran Status Request References.
     * - maxOccurs: unbounded
     * @var \StructType\Veteran_StatusObjectType[]
     */
    public $Veteran_Status_Reference;
    /**
     * Constructor method for Veteran_Status_Request_ReferencesType
     * @uses Veteran_Status_Request_ReferencesType::setVeteran_Status_Reference()
     * @param \StructType\Veteran_StatusObjectType[] $veteran_Status_Reference
     */
    public function __construct(array $veteran_Status_Reference = array())
    {
        $this
            ->setVeteran_Status_Reference($veteran_Status_Reference);
    }
    /**
     * Get Veteran_Status_Reference value
     * @return \StructType\Veteran_StatusObjectType[]|null
     */
    public function getVeteran_Status_Reference()
    {
        return $this->Veteran_Status_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setVeteran_Status_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setVeteran_Status_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateVeteran_Status_ReferenceForArrayConstraintsFromSetVeteran_Status_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $veteran_Status_Request_ReferencesTypeVeteran_Status_ReferenceItem) {
            // validation for constraint: itemType
            if (!$veteran_Status_Request_ReferencesTypeVeteran_Status_ReferenceItem instanceof \StructType\Veteran_StatusObjectType) {
                $invalidValues[] = is_object($veteran_Status_Request_ReferencesTypeVeteran_Status_ReferenceItem) ? get_class($veteran_Status_Request_ReferencesTypeVeteran_Status_ReferenceItem) : sprintf('%s(%s)', gettype($veteran_Status_Request_ReferencesTypeVeteran_Status_ReferenceItem), var_export($veteran_Status_Request_ReferencesTypeVeteran_Status_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Veteran_Status_Reference property can only contain items of type \StructType\Veteran_StatusObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Veteran_Status_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Veteran_StatusObjectType[] $veteran_Status_Reference
     * @return \StructType\Veteran_Status_Request_ReferencesType
     */
    public function setVeteran_Status_Reference(array $veteran_Status_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($veteran_Status_ReferenceArrayErrorMessage = self::validateVeteran_Status_ReferenceForArrayConstraintsFromSetVeteran_Status_Reference($veteran_Status_Reference))) {
            throw new \InvalidArgumentException($veteran_Status_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Veteran_Status_Reference = $veteran_Status_Reference;
        return $this;
    }
    /**
     * Add item to Veteran_Status_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Veteran_StatusObjectType $item
     * @return \StructType\Veteran_Status_Request_ReferencesType
     */
    public function addToVeteran_Status_Reference(\StructType\Veteran_StatusObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Veteran_StatusObjectType) {
            throw new \InvalidArgumentException(sprintf('The Veteran_Status_Reference property can only contain items of type \StructType\Veteran_StatusObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Veteran_Status_Reference[] = $item;
        return $this;
    }
}
