<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for
 * Bulk_Import_Submit_Remit_To_Supplier_Connection_RequestType StructType
 * Meta information extracted from the WSDL
 * - documentation: Contains data for processing many instances of Remit To Supplier Connection.
 * @subpackage Structs
 */
class Bulk_Import_Submit_Remit_To_Supplier_Connection_RequestType extends AbstractStructBase
{
    /**
     * The Submit_Remit_To_Supplier_Connection_Request
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Submit_Remit_To_Supplier_Connection_RequestType[]
     */
    public $Submit_Remit_To_Supplier_Connection_Request;
    /**
     * The version
     * Meta information extracted from the WSDL
     * - ref: wd:version
     * @var string
     */
    public $version;
    /**
     * Constructor method for
     * Bulk_Import_Submit_Remit_To_Supplier_Connection_RequestType
     * @uses Bulk_Import_Submit_Remit_To_Supplier_Connection_RequestType::setSubmit_Remit_To_Supplier_Connection_Request()
     * @uses Bulk_Import_Submit_Remit_To_Supplier_Connection_RequestType::setVersion()
     * @param \StructType\Submit_Remit_To_Supplier_Connection_RequestType[] $submit_Remit_To_Supplier_Connection_Request
     * @param string $version
     */
    public function __construct(array $submit_Remit_To_Supplier_Connection_Request = array(), $version = null)
    {
        $this
            ->setSubmit_Remit_To_Supplier_Connection_Request($submit_Remit_To_Supplier_Connection_Request)
            ->setVersion($version);
    }
    /**
     * Get Submit_Remit_To_Supplier_Connection_Request value
     * @return \StructType\Submit_Remit_To_Supplier_Connection_RequestType[]|null
     */
    public function getSubmit_Remit_To_Supplier_Connection_Request()
    {
        return $this->Submit_Remit_To_Supplier_Connection_Request;
    }
    /**
     * This method is responsible for validating the values passed to the setSubmit_Remit_To_Supplier_Connection_Request method
     * This method is willingly generated in order to preserve the one-line inline validation within the setSubmit_Remit_To_Supplier_Connection_Request method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateSubmit_Remit_To_Supplier_Connection_RequestForArrayConstraintsFromSetSubmit_Remit_To_Supplier_Connection_Request(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $bulk_Import_Submit_Remit_To_Supplier_Connection_RequestTypeSubmit_Remit_To_Supplier_Connection_RequestItem) {
            // validation for constraint: itemType
            if (!$bulk_Import_Submit_Remit_To_Supplier_Connection_RequestTypeSubmit_Remit_To_Supplier_Connection_RequestItem instanceof \StructType\Submit_Remit_To_Supplier_Connection_RequestType) {
                $invalidValues[] = is_object($bulk_Import_Submit_Remit_To_Supplier_Connection_RequestTypeSubmit_Remit_To_Supplier_Connection_RequestItem) ? get_class($bulk_Import_Submit_Remit_To_Supplier_Connection_RequestTypeSubmit_Remit_To_Supplier_Connection_RequestItem) : sprintf('%s(%s)', gettype($bulk_Import_Submit_Remit_To_Supplier_Connection_RequestTypeSubmit_Remit_To_Supplier_Connection_RequestItem), var_export($bulk_Import_Submit_Remit_To_Supplier_Connection_RequestTypeSubmit_Remit_To_Supplier_Connection_RequestItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Submit_Remit_To_Supplier_Connection_Request property can only contain items of type \StructType\Submit_Remit_To_Supplier_Connection_RequestType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Submit_Remit_To_Supplier_Connection_Request value
     * @throws \InvalidArgumentException
     * @param \StructType\Submit_Remit_To_Supplier_Connection_RequestType[] $submit_Remit_To_Supplier_Connection_Request
     * @return \StructType\Bulk_Import_Submit_Remit_To_Supplier_Connection_RequestType
     */
    public function setSubmit_Remit_To_Supplier_Connection_Request(array $submit_Remit_To_Supplier_Connection_Request = array())
    {
        // validation for constraint: array
        if ('' !== ($submit_Remit_To_Supplier_Connection_RequestArrayErrorMessage = self::validateSubmit_Remit_To_Supplier_Connection_RequestForArrayConstraintsFromSetSubmit_Remit_To_Supplier_Connection_Request($submit_Remit_To_Supplier_Connection_Request))) {
            throw new \InvalidArgumentException($submit_Remit_To_Supplier_Connection_RequestArrayErrorMessage, __LINE__);
        }
        $this->Submit_Remit_To_Supplier_Connection_Request = $submit_Remit_To_Supplier_Connection_Request;
        return $this;
    }
    /**
     * Add item to Submit_Remit_To_Supplier_Connection_Request value
     * @throws \InvalidArgumentException
     * @param \StructType\Submit_Remit_To_Supplier_Connection_RequestType $item
     * @return \StructType\Bulk_Import_Submit_Remit_To_Supplier_Connection_RequestType
     */
    public function addToSubmit_Remit_To_Supplier_Connection_Request(\StructType\Submit_Remit_To_Supplier_Connection_RequestType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Submit_Remit_To_Supplier_Connection_RequestType) {
            throw new \InvalidArgumentException(sprintf('The Submit_Remit_To_Supplier_Connection_Request property can only contain items of type \StructType\Submit_Remit_To_Supplier_Connection_RequestType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Submit_Remit_To_Supplier_Connection_Request[] = $item;
        return $this;
    }
    /**
     * Get version value
     * @return string|null
     */
    public function getVersion()
    {
        return $this->version;
    }
    /**
     * Set version value
     * @param string $version
     * @return \StructType\Bulk_Import_Submit_Remit_To_Supplier_Connection_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;
    }
}
