<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Business_Entity_Alternate_Name_Widget_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: When Delete is set to true, Replace All must be set to false in the Business Entity Alternate Name Widget. | This Usage is already in use. A specific alternate name usage can only be used once per business entity. | Contains
 * information about the alternate name for the business entity.
 * @subpackage Structs
 */
class Business_Entity_Alternate_Name_Widget_DataType extends AbstractStructBase
{
    /**
     * The Business_Entity_Alternate_Name_Data
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * @var \StructType\Business_Entity_Alternate_Name_WWS_DataType[]
     */
    public $Business_Entity_Alternate_Name_Data;
    /**
     * The Replace_All
     * Meta information extracted from the WSDL
     * - documentation: Specify True to replace all existing data in the element. You must specify values for all subelements. Specify False to add new data, change some existing data, or delete existing data.
     * @var bool
     */
    public $Replace_All;
    /**
     * Constructor method for Business_Entity_Alternate_Name_Widget_DataType
     * @uses Business_Entity_Alternate_Name_Widget_DataType::setBusiness_Entity_Alternate_Name_Data()
     * @uses Business_Entity_Alternate_Name_Widget_DataType::setReplace_All()
     * @param \StructType\Business_Entity_Alternate_Name_WWS_DataType[] $business_Entity_Alternate_Name_Data
     * @param bool $replace_All
     */
    public function __construct(array $business_Entity_Alternate_Name_Data = array(), $replace_All = null)
    {
        $this
            ->setBusiness_Entity_Alternate_Name_Data($business_Entity_Alternate_Name_Data)
            ->setReplace_All($replace_All);
    }
    /**
     * Get Business_Entity_Alternate_Name_Data value
     * @return \StructType\Business_Entity_Alternate_Name_WWS_DataType[]|null
     */
    public function getBusiness_Entity_Alternate_Name_Data()
    {
        return $this->Business_Entity_Alternate_Name_Data;
    }
    /**
     * This method is responsible for validating the values passed to the setBusiness_Entity_Alternate_Name_Data method
     * This method is willingly generated in order to preserve the one-line inline validation within the setBusiness_Entity_Alternate_Name_Data method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateBusiness_Entity_Alternate_Name_DataForArrayConstraintsFromSetBusiness_Entity_Alternate_Name_Data(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $business_Entity_Alternate_Name_Widget_DataTypeBusiness_Entity_Alternate_Name_DataItem) {
            // validation for constraint: itemType
            if (!$business_Entity_Alternate_Name_Widget_DataTypeBusiness_Entity_Alternate_Name_DataItem instanceof \StructType\Business_Entity_Alternate_Name_WWS_DataType) {
                $invalidValues[] = is_object($business_Entity_Alternate_Name_Widget_DataTypeBusiness_Entity_Alternate_Name_DataItem) ? get_class($business_Entity_Alternate_Name_Widget_DataTypeBusiness_Entity_Alternate_Name_DataItem) : sprintf('%s(%s)', gettype($business_Entity_Alternate_Name_Widget_DataTypeBusiness_Entity_Alternate_Name_DataItem), var_export($business_Entity_Alternate_Name_Widget_DataTypeBusiness_Entity_Alternate_Name_DataItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Business_Entity_Alternate_Name_Data property can only contain items of type \StructType\Business_Entity_Alternate_Name_WWS_DataType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Business_Entity_Alternate_Name_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Business_Entity_Alternate_Name_WWS_DataType[] $business_Entity_Alternate_Name_Data
     * @return \StructType\Business_Entity_Alternate_Name_Widget_DataType
     */
    public function setBusiness_Entity_Alternate_Name_Data(array $business_Entity_Alternate_Name_Data = array())
    {
        // validation for constraint: array
        if ('' !== ($business_Entity_Alternate_Name_DataArrayErrorMessage = self::validateBusiness_Entity_Alternate_Name_DataForArrayConstraintsFromSetBusiness_Entity_Alternate_Name_Data($business_Entity_Alternate_Name_Data))) {
            throw new \InvalidArgumentException($business_Entity_Alternate_Name_DataArrayErrorMessage, __LINE__);
        }
        $this->Business_Entity_Alternate_Name_Data = $business_Entity_Alternate_Name_Data;
        return $this;
    }
    /**
     * Add item to Business_Entity_Alternate_Name_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Business_Entity_Alternate_Name_WWS_DataType $item
     * @return \StructType\Business_Entity_Alternate_Name_Widget_DataType
     */
    public function addToBusiness_Entity_Alternate_Name_Data(\StructType\Business_Entity_Alternate_Name_WWS_DataType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Business_Entity_Alternate_Name_WWS_DataType) {
            throw new \InvalidArgumentException(sprintf('The Business_Entity_Alternate_Name_Data property can only contain items of type \StructType\Business_Entity_Alternate_Name_WWS_DataType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Business_Entity_Alternate_Name_Data[] = $item;
        return $this;
    }
    /**
     * Get Replace_All value
     * @return bool|null
     */
    public function getReplace_All()
    {
        return $this->Replace_All;
    }
    /**
     * Set Replace_All value
     * @param bool $replace_All
     * @return \StructType\Business_Entity_Alternate_Name_Widget_DataType
     */
    public function setReplace_All($replace_All = null)
    {
        // validation for constraint: boolean
        if (!is_null($replace_All) && !is_bool($replace_All)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($replace_All, true), gettype($replace_All)), __LINE__);
        }
        $this->Replace_All = $replace_All;
        return $this;
    }
}
