<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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