<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Resume_Asset_Depreciation_RequestType StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing data needed to resume asset depreciation.
 * @subpackage Structs
 */
class Resume_Asset_Depreciation_RequestType extends AbstractStructBase
{
    /**
     * The Resume_Asset_Depreciation_Data
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Resume_Asset_Depreciation_for_WWS_DataType[]
     */
    public $Resume_Asset_Depreciation_Data;
    /**
     * The version
     * Meta information extracted from the WSDL
     * - ref: wd:version
     * @var string
     */
    public $version;
    /**
     * Constructor method for Resume_Asset_Depreciation_RequestType
     * @uses Resume_Asset_Depreciation_RequestType::setResume_Asset_Depreciation_Data()
     * @uses Resume_Asset_Depreciation_RequestType::setVersion()
     * @param \StructType\Resume_Asset_Depreciation_for_WWS_DataType[] $resume_Asset_Depreciation_Data
     * @param string $version
     */
    public function __construct(array $resume_Asset_Depreciation_Data = array(), $version = null)
    {
        $this
            ->setResume_Asset_Depreciation_Data($resume_Asset_Depreciation_Data)
            ->setVersion($version);
    }
    /**
     * Get Resume_Asset_Depreciation_Data value
     * @return \StructType\Resume_Asset_Depreciation_for_WWS_DataType[]|null
     */
    public function getResume_Asset_Depreciation_Data()
    {
        return $this->Resume_Asset_Depreciation_Data;
    }
    /**
     * This method is responsible for validating the values passed to the setResume_Asset_Depreciation_Data method
     * This method is willingly generated in order to preserve the one-line inline validation within the setResume_Asset_Depreciation_Data method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateResume_Asset_Depreciation_DataForArrayConstraintsFromSetResume_Asset_Depreciation_Data(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $resume_Asset_Depreciation_RequestTypeResume_Asset_Depreciation_DataItem) {
            // validation for constraint: itemType
            if (!$resume_Asset_Depreciation_RequestTypeResume_Asset_Depreciation_DataItem instanceof \StructType\Resume_Asset_Depreciation_for_WWS_DataType) {
                $invalidValues[] = is_object($resume_Asset_Depreciation_RequestTypeResume_Asset_Depreciation_DataItem) ? get_class($resume_Asset_Depreciation_RequestTypeResume_Asset_Depreciation_DataItem) : sprintf('%s(%s)', gettype($resume_Asset_Depreciation_RequestTypeResume_Asset_Depreciation_DataItem), var_export($resume_Asset_Depreciation_RequestTypeResume_Asset_Depreciation_DataItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Resume_Asset_Depreciation_Data property can only contain items of type \StructType\Resume_Asset_Depreciation_for_WWS_DataType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Resume_Asset_Depreciation_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Resume_Asset_Depreciation_for_WWS_DataType[] $resume_Asset_Depreciation_Data
     * @return \StructType\Resume_Asset_Depreciation_RequestType
     */
    public function setResume_Asset_Depreciation_Data(array $resume_Asset_Depreciation_Data = array())
    {
        // validation for constraint: array
        if ('' !== ($resume_Asset_Depreciation_DataArrayErrorMessage = self::validateResume_Asset_Depreciation_DataForArrayConstraintsFromSetResume_Asset_Depreciation_Data($resume_Asset_Depreciation_Data))) {
            throw new \InvalidArgumentException($resume_Asset_Depreciation_DataArrayErrorMessage, __LINE__);
        }
        $this->Resume_Asset_Depreciation_Data = $resume_Asset_Depreciation_Data;
        return $this;
    }
    /**
     * Add item to Resume_Asset_Depreciation_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Resume_Asset_Depreciation_for_WWS_DataType $item
     * @return \StructType\Resume_Asset_Depreciation_RequestType
     */
    public function addToResume_Asset_Depreciation_Data(\StructType\Resume_Asset_Depreciation_for_WWS_DataType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Resume_Asset_Depreciation_for_WWS_DataType) {
            throw new \InvalidArgumentException(sprintf('The Resume_Asset_Depreciation_Data property can only contain items of type \StructType\Resume_Asset_Depreciation_for_WWS_DataType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Resume_Asset_Depreciation_Data[] = $item;
        return $this;
    }
    /**
     * Get version value
     * @return string|null
     */
    public function getVersion()
    {
        return $this->version;
    }
    /**
     * Set version value
     * @param string $version
     * @return \StructType\Resume_Asset_Depreciation_RequestType
     */
    public function setVersion($version = null)
    {
        // validation for constraint: string
        if (!is_null($version) && !is_string($version)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($version, true), gettype($version)), __LINE__);
        }
        $this->version = $version;
        return $this;
    }
}
