<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Job_Requisition_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Contains each Job Requisition based on the Request References or Request Criteria.
 * @subpackage Structs
 */
class Job_Requisition_Response_DataType extends AbstractStructBase
{
    /**
     * The Job_Requisition
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Job_RequisitionType[]
     */
    public $Job_Requisition;
    /**
     * Constructor method for Job_Requisition_Response_DataType
     * @uses Job_Requisition_Response_DataType::setJob_Requisition()
     * @param \StructType\Job_RequisitionType[] $job_Requisition
     */
    public function __construct(array $job_Requisition = array())
    {
        $this
            ->setJob_Requisition($job_Requisition);
    }
    /**
     * Get Job_Requisition value
     * @return \StructType\Job_RequisitionType[]|null
     */
    public function getJob_Requisition()
    {
        return $this->Job_Requisition;
    }
    /**
     * This method is responsible for validating the values passed to the setJob_Requisition method
     * This method is willingly generated in order to preserve the one-line inline validation within the setJob_Requisition method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateJob_RequisitionForArrayConstraintsFromSetJob_Requisition(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $job_Requisition_Response_DataTypeJob_RequisitionItem) {
            // validation for constraint: itemType
            if (!$job_Requisition_Response_DataTypeJob_RequisitionItem instanceof \StructType\Job_RequisitionType) {
                $invalidValues[] = is_object($job_Requisition_Response_DataTypeJob_RequisitionItem) ? get_class($job_Requisition_Response_DataTypeJob_RequisitionItem) : sprintf('%s(%s)', gettype($job_Requisition_Response_DataTypeJob_RequisitionItem), var_export($job_Requisition_Response_DataTypeJob_RequisitionItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Job_Requisition property can only contain items of type \StructType\Job_RequisitionType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Job_Requisition value
     * @throws \InvalidArgumentException
     * @param \StructType\Job_RequisitionType[] $job_Requisition
     * @return \StructType\Job_Requisition_Response_DataType
     */
    public function setJob_Requisition(array $job_Requisition = array())
    {
        // validation for constraint: array
        if ('' !== ($job_RequisitionArrayErrorMessage = self::validateJob_RequisitionForArrayConstraintsFromSetJob_Requisition($job_Requisition))) {
            throw new \InvalidArgumentException($job_RequisitionArrayErrorMessage, __LINE__);
        }
        $this->Job_Requisition = $job_Requisition;
        return $this;
    }
    /**
     * Add item to Job_Requisition value
     * @throws \InvalidArgumentException
     * @param \StructType\Job_RequisitionType $item
     * @return \StructType\Job_Requisition_Response_DataType
     */
    public function addToJob_Requisition(\StructType\Job_RequisitionType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Job_RequisitionType) {
            throw new \InvalidArgumentException(sprintf('The Job_Requisition property can only contain items of type \StructType\Job_RequisitionType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Job_Requisition[] = $item;
        return $this;
    }
}
