<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Worker_Utilization_Target_Sheets_Request_ReferencesType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing references to Worker Utilization Target Sheets
 * @subpackage Structs
 */
class Worker_Utilization_Target_Sheets_Request_ReferencesType extends AbstractStructBase
{
    /**
     * The Worker_Utilization_Target_Sheet_Request_Reference
     * Meta information extracted from the WSDL
     * - documentation: Worker Utilization Target Sheet Request Reference
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Utilization_Target_SheetObjectType[]
     */
    public $Worker_Utilization_Target_Sheet_Request_Reference;
    /**
     * Constructor method for Worker_Utilization_Target_Sheets_Request_ReferencesType
     * @uses Worker_Utilization_Target_Sheets_Request_ReferencesType::setWorker_Utilization_Target_Sheet_Request_Reference()
     * @param \StructType\Utilization_Target_SheetObjectType[] $worker_Utilization_Target_Sheet_Request_Reference
     */
    public function __construct(array $worker_Utilization_Target_Sheet_Request_Reference = array())
    {
        $this
            ->setWorker_Utilization_Target_Sheet_Request_Reference($worker_Utilization_Target_Sheet_Request_Reference);
    }
    /**
     * Get Worker_Utilization_Target_Sheet_Request_Reference value
     * @return \StructType\Utilization_Target_SheetObjectType[]|null
     */
    public function getWorker_Utilization_Target_Sheet_Request_Reference()
    {
        return $this->Worker_Utilization_Target_Sheet_Request_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setWorker_Utilization_Target_Sheet_Request_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setWorker_Utilization_Target_Sheet_Request_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateWorker_Utilization_Target_Sheet_Request_ReferenceForArrayConstraintsFromSetWorker_Utilization_Target_Sheet_Request_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $worker_Utilization_Target_Sheets_Request_ReferencesTypeWorker_Utilization_Target_Sheet_Request_ReferenceItem) {
            // validation for constraint: itemType
            if (!$worker_Utilization_Target_Sheets_Request_ReferencesTypeWorker_Utilization_Target_Sheet_Request_ReferenceItem instanceof \StructType\Utilization_Target_SheetObjectType) {
                $invalidValues[] = is_object($worker_Utilization_Target_Sheets_Request_ReferencesTypeWorker_Utilization_Target_Sheet_Request_ReferenceItem) ? get_class($worker_Utilization_Target_Sheets_Request_ReferencesTypeWorker_Utilization_Target_Sheet_Request_ReferenceItem) : sprintf('%s(%s)', gettype($worker_Utilization_Target_Sheets_Request_ReferencesTypeWorker_Utilization_Target_Sheet_Request_ReferenceItem), var_export($worker_Utilization_Target_Sheets_Request_ReferencesTypeWorker_Utilization_Target_Sheet_Request_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Worker_Utilization_Target_Sheet_Request_Reference property can only contain items of type \StructType\Utilization_Target_SheetObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Worker_Utilization_Target_Sheet_Request_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Utilization_Target_SheetObjectType[] $worker_Utilization_Target_Sheet_Request_Reference
     * @return \StructType\Worker_Utilization_Target_Sheets_Request_ReferencesType
     */
    public function setWorker_Utilization_Target_Sheet_Request_Reference(array $worker_Utilization_Target_Sheet_Request_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($worker_Utilization_Target_Sheet_Request_ReferenceArrayErrorMessage = self::validateWorker_Utilization_Target_Sheet_Request_ReferenceForArrayConstraintsFromSetWorker_Utilization_Target_Sheet_Request_Reference($worker_Utilization_Target_Sheet_Request_Reference))) {
            throw new \InvalidArgumentException($worker_Utilization_Target_Sheet_Request_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Worker_Utilization_Target_Sheet_Request_Reference = $worker_Utilization_Target_Sheet_Request_Reference;
        return $this;
    }
    /**
     * Add item to Worker_Utilization_Target_Sheet_Request_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Utilization_Target_SheetObjectType $item
     * @return \StructType\Worker_Utilization_Target_Sheets_Request_ReferencesType
     */
    public function addToWorker_Utilization_Target_Sheet_Request_Reference(\StructType\Utilization_Target_SheetObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Utilization_Target_SheetObjectType) {
            throw new \InvalidArgumentException(sprintf('The Worker_Utilization_Target_Sheet_Request_Reference property can only contain items of type \StructType\Utilization_Target_SheetObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Worker_Utilization_Target_Sheet_Request_Reference[] = $item;
        return $this;
    }
}
