<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for External_Reference_Request_ReferencesType StructType
 * Meta information extracted from the WSDL
 * - documentation: The reference check events you want to retrieve.
 * @subpackage Structs
 */
class External_Reference_Request_ReferencesType extends AbstractStructBase
{
    /**
     * The Reference_Check_Event_Reference
     * Meta information extracted from the WSDL
     * - documentation: The Reference ID of the Reference Check Event.
     * - maxOccurs: unbounded
     * @var \StructType\Unique_IdentifierObjectType[]
     */
    public $Reference_Check_Event_Reference;
    /**
     * Constructor method for External_Reference_Request_ReferencesType
     * @uses External_Reference_Request_ReferencesType::setReference_Check_Event_Reference()
     * @param \StructType\Unique_IdentifierObjectType[] $reference_Check_Event_Reference
     */
    public function __construct(array $reference_Check_Event_Reference = array())
    {
        $this
            ->setReference_Check_Event_Reference($reference_Check_Event_Reference);
    }
    /**
     * Get Reference_Check_Event_Reference value
     * @return \StructType\Unique_IdentifierObjectType[]|null
     */
    public function getReference_Check_Event_Reference()
    {
        return $this->Reference_Check_Event_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setReference_Check_Event_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setReference_Check_Event_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateReference_Check_Event_ReferenceForArrayConstraintsFromSetReference_Check_Event_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $external_Reference_Request_ReferencesTypeReference_Check_Event_ReferenceItem) {
            // validation for constraint: itemType
            if (!$external_Reference_Request_ReferencesTypeReference_Check_Event_ReferenceItem instanceof \StructType\Unique_IdentifierObjectType) {
                $invalidValues[] = is_object($external_Reference_Request_ReferencesTypeReference_Check_Event_ReferenceItem) ? get_class($external_Reference_Request_ReferencesTypeReference_Check_Event_ReferenceItem) : sprintf('%s(%s)', gettype($external_Reference_Request_ReferencesTypeReference_Check_Event_ReferenceItem), var_export($external_Reference_Request_ReferencesTypeReference_Check_Event_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Reference_Check_Event_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 Reference_Check_Event_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Unique_IdentifierObjectType[] $reference_Check_Event_Reference
     * @return \StructType\External_Reference_Request_ReferencesType
     */
    public function setReference_Check_Event_Reference(array $reference_Check_Event_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($reference_Check_Event_ReferenceArrayErrorMessage = self::validateReference_Check_Event_ReferenceForArrayConstraintsFromSetReference_Check_Event_Reference($reference_Check_Event_Reference))) {
            throw new \InvalidArgumentException($reference_Check_Event_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Reference_Check_Event_Reference = $reference_Check_Event_Reference;
        return $this;
    }
    /**
     * Add item to Reference_Check_Event_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Unique_IdentifierObjectType $item
     * @return \StructType\External_Reference_Request_ReferencesType
     */
    public function addToReference_Check_Event_Reference(\StructType\Unique_IdentifierObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Unique_IdentifierObjectType) {
            throw new \InvalidArgumentException(sprintf('The Reference_Check_Event_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->Reference_Check_Event_Reference[] = $item;
        return $this;
    }
}
