<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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