<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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