<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Tax_Certificate_Numbers_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Information Relating to Gapless Tax Certificate Numbers
 * @subpackage Structs
 */
class Tax_Certificate_Numbers_DataType extends AbstractStructBase
{
    /**
     * The Tax_Certificate_Number
     * Meta information extracted from the WSDL
     * - documentation: Information Relating to Gapless Tax Certificate Numbers
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Withholding_Tax_Certificate_NumberType[]
     */
    public $Tax_Certificate_Number;
    /**
     * Constructor method for Tax_Certificate_Numbers_DataType
     * @uses Tax_Certificate_Numbers_DataType::setTax_Certificate_Number()
     * @param \StructType\Withholding_Tax_Certificate_NumberType[] $tax_Certificate_Number
     */
    public function __construct(array $tax_Certificate_Number = array())
    {
        $this
            ->setTax_Certificate_Number($tax_Certificate_Number);
    }
    /**
     * Get Tax_Certificate_Number value
     * @return \StructType\Withholding_Tax_Certificate_NumberType[]|null
     */
    public function getTax_Certificate_Number()
    {
        return $this->Tax_Certificate_Number;
    }
    /**
     * This method is responsible for validating the values passed to the setTax_Certificate_Number method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTax_Certificate_Number method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTax_Certificate_NumberForArrayConstraintsFromSetTax_Certificate_Number(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $tax_Certificate_Numbers_DataTypeTax_Certificate_NumberItem) {
            // validation for constraint: itemType
            if (!$tax_Certificate_Numbers_DataTypeTax_Certificate_NumberItem instanceof \StructType\Withholding_Tax_Certificate_NumberType) {
                $invalidValues[] = is_object($tax_Certificate_Numbers_DataTypeTax_Certificate_NumberItem) ? get_class($tax_Certificate_Numbers_DataTypeTax_Certificate_NumberItem) : sprintf('%s(%s)', gettype($tax_Certificate_Numbers_DataTypeTax_Certificate_NumberItem), var_export($tax_Certificate_Numbers_DataTypeTax_Certificate_NumberItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Tax_Certificate_Number property can only contain items of type \StructType\Withholding_Tax_Certificate_NumberType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Tax_Certificate_Number value
     * @throws \InvalidArgumentException
     * @param \StructType\Withholding_Tax_Certificate_NumberType[] $tax_Certificate_Number
     * @return \StructType\Tax_Certificate_Numbers_DataType
     */
    public function setTax_Certificate_Number(array $tax_Certificate_Number = array())
    {
        // validation for constraint: array
        if ('' !== ($tax_Certificate_NumberArrayErrorMessage = self::validateTax_Certificate_NumberForArrayConstraintsFromSetTax_Certificate_Number($tax_Certificate_Number))) {
            throw new \InvalidArgumentException($tax_Certificate_NumberArrayErrorMessage, __LINE__);
        }
        $this->Tax_Certificate_Number = $tax_Certificate_Number;
        return $this;
    }
    /**
     * Add item to Tax_Certificate_Number value
     * @throws \InvalidArgumentException
     * @param \StructType\Withholding_Tax_Certificate_NumberType $item
     * @return \StructType\Tax_Certificate_Numbers_DataType
     */
    public function addToTax_Certificate_Number(\StructType\Withholding_Tax_Certificate_NumberType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Withholding_Tax_Certificate_NumberType) {
            throw new \InvalidArgumentException(sprintf('The Tax_Certificate_Number property can only contain items of type \StructType\Withholding_Tax_Certificate_NumberType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Tax_Certificate_Number[] = $item;
        return $this;
    }
}
