<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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