<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Advanced_Ship_Notice_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Root Response Element that represents the Reference to the Advanced Ship Notice Document along with its content
 * @subpackage Structs
 */
class Advanced_Ship_Notice_Response_DataType extends AbstractStructBase
{
    /**
     * The Advanced_Ship_Notice
     * Meta information extracted from the WSDL
     * - documentation: Element that represents the Reference to the Advanced Ship Notice Document along with its content
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Advanced_Ship_Notice_OutboundType[]
     */
    public $Advanced_Ship_Notice;
    /**
     * Constructor method for Advanced_Ship_Notice_Response_DataType
     * @uses Advanced_Ship_Notice_Response_DataType::setAdvanced_Ship_Notice()
     * @param \StructType\Advanced_Ship_Notice_OutboundType[] $advanced_Ship_Notice
     */
    public function __construct(array $advanced_Ship_Notice = array())
    {
        $this
            ->setAdvanced_Ship_Notice($advanced_Ship_Notice);
    }
    /**
     * Get Advanced_Ship_Notice value
     * @return \StructType\Advanced_Ship_Notice_OutboundType[]|null
     */
    public function getAdvanced_Ship_Notice()
    {
        return $this->Advanced_Ship_Notice;
    }
    /**
     * This method is responsible for validating the values passed to the setAdvanced_Ship_Notice method
     * This method is willingly generated in order to preserve the one-line inline validation within the setAdvanced_Ship_Notice method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateAdvanced_Ship_NoticeForArrayConstraintsFromSetAdvanced_Ship_Notice(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $advanced_Ship_Notice_Response_DataTypeAdvanced_Ship_NoticeItem) {
            // validation for constraint: itemType
            if (!$advanced_Ship_Notice_Response_DataTypeAdvanced_Ship_NoticeItem instanceof \StructType\Advanced_Ship_Notice_OutboundType) {
                $invalidValues[] = is_object($advanced_Ship_Notice_Response_DataTypeAdvanced_Ship_NoticeItem) ? get_class($advanced_Ship_Notice_Response_DataTypeAdvanced_Ship_NoticeItem) : sprintf('%s(%s)', gettype($advanced_Ship_Notice_Response_DataTypeAdvanced_Ship_NoticeItem), var_export($advanced_Ship_Notice_Response_DataTypeAdvanced_Ship_NoticeItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Advanced_Ship_Notice property can only contain items of type \StructType\Advanced_Ship_Notice_OutboundType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Advanced_Ship_Notice value
     * @throws \InvalidArgumentException
     * @param \StructType\Advanced_Ship_Notice_OutboundType[] $advanced_Ship_Notice
     * @return \StructType\Advanced_Ship_Notice_Response_DataType
     */
    public function setAdvanced_Ship_Notice(array $advanced_Ship_Notice = array())
    {
        // validation for constraint: array
        if ('' !== ($advanced_Ship_NoticeArrayErrorMessage = self::validateAdvanced_Ship_NoticeForArrayConstraintsFromSetAdvanced_Ship_Notice($advanced_Ship_Notice))) {
            throw new \InvalidArgumentException($advanced_Ship_NoticeArrayErrorMessage, __LINE__);
        }
        $this->Advanced_Ship_Notice = $advanced_Ship_Notice;
        return $this;
    }
    /**
     * Add item to Advanced_Ship_Notice value
     * @throws \InvalidArgumentException
     * @param \StructType\Advanced_Ship_Notice_OutboundType $item
     * @return \StructType\Advanced_Ship_Notice_Response_DataType
     */
    public function addToAdvanced_Ship_Notice(\StructType\Advanced_Ship_Notice_OutboundType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Advanced_Ship_Notice_OutboundType) {
            throw new \InvalidArgumentException(sprintf('The Advanced_Ship_Notice property can only contain items of type \StructType\Advanced_Ship_Notice_OutboundType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Advanced_Ship_Notice[] = $item;
        return $this;
    }
}
