<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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