<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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