<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Resource_Requirements_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: .
 * @subpackage Structs
 */
class Resource_Requirements_Response_DataType extends AbstractStructBase
{
    /**
     * The Resource_Plan_Requirement
     * Meta information extracted from the WSDL
     * - documentation: .Resource Plan
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Resource_Plan_for_RequirementsType[]
     */
    public $Resource_Plan_Requirement;
    /**
     * Constructor method for Resource_Requirements_Response_DataType
     * @uses Resource_Requirements_Response_DataType::setResource_Plan_Requirement()
     * @param \StructType\Resource_Plan_for_RequirementsType[] $resource_Plan_Requirement
     */
    public function __construct(array $resource_Plan_Requirement = array())
    {
        $this
            ->setResource_Plan_Requirement($resource_Plan_Requirement);
    }
    /**
     * Get Resource_Plan_Requirement value
     * @return \StructType\Resource_Plan_for_RequirementsType[]|null
     */
    public function getResource_Plan_Requirement()
    {
        return $this->Resource_Plan_Requirement;
    }
    /**
     * This method is responsible for validating the values passed to the setResource_Plan_Requirement method
     * This method is willingly generated in order to preserve the one-line inline validation within the setResource_Plan_Requirement method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateResource_Plan_RequirementForArrayConstraintsFromSetResource_Plan_Requirement(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $resource_Requirements_Response_DataTypeResource_Plan_RequirementItem) {
            // validation for constraint: itemType
            if (!$resource_Requirements_Response_DataTypeResource_Plan_RequirementItem instanceof \StructType\Resource_Plan_for_RequirementsType) {
                $invalidValues[] = is_object($resource_Requirements_Response_DataTypeResource_Plan_RequirementItem) ? get_class($resource_Requirements_Response_DataTypeResource_Plan_RequirementItem) : sprintf('%s(%s)', gettype($resource_Requirements_Response_DataTypeResource_Plan_RequirementItem), var_export($resource_Requirements_Response_DataTypeResource_Plan_RequirementItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Resource_Plan_Requirement property can only contain items of type \StructType\Resource_Plan_for_RequirementsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Resource_Plan_Requirement value
     * @throws \InvalidArgumentException
     * @param \StructType\Resource_Plan_for_RequirementsType[] $resource_Plan_Requirement
     * @return \StructType\Resource_Requirements_Response_DataType
     */
    public function setResource_Plan_Requirement(array $resource_Plan_Requirement = array())
    {
        // validation for constraint: array
        if ('' !== ($resource_Plan_RequirementArrayErrorMessage = self::validateResource_Plan_RequirementForArrayConstraintsFromSetResource_Plan_Requirement($resource_Plan_Requirement))) {
            throw new \InvalidArgumentException($resource_Plan_RequirementArrayErrorMessage, __LINE__);
        }
        $this->Resource_Plan_Requirement = $resource_Plan_Requirement;
        return $this;
    }
    /**
     * Add item to Resource_Plan_Requirement value
     * @throws \InvalidArgumentException
     * @param \StructType\Resource_Plan_for_RequirementsType $item
     * @return \StructType\Resource_Requirements_Response_DataType
     */
    public function addToResource_Plan_Requirement(\StructType\Resource_Plan_for_RequirementsType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Resource_Plan_for_RequirementsType) {
            throw new \InvalidArgumentException(sprintf('The Resource_Plan_Requirement property can only contain items of type \StructType\Resource_Plan_for_RequirementsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Resource_Plan_Requirement[] = $item;
        return $this;
    }
}
