<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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