<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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