<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Business_Entity_Alternate_Name_WWS_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: The alternate name usage is not valid for a Customer | The alternate name usage is not valid for a Supplier | The alternate name usage is not valid for an Investor. | Business Entity Alternate Name Data.
 * @subpackage Structs
 */
class Business_Entity_Alternate_Name_WWS_DataType extends AbstractStructBase
{
    /**
     * The Alternate_Name
     * Meta information extracted from the WSDL
     * - documentation: Business Entity Alternate Name.
     * - maxOccurs: 1
     * @var string
     */
    public $Alternate_Name;
    /**
     * The Alternate_Name_Usage_Reference
     * Meta information extracted from the WSDL
     * - documentation: Reference to an existing Business Entity Alternate Name Usage. The Usages are supplied by Workday. Valid values for Supplier are: IRS_1099_RECIPIENT, REMIT_TO_ADDRESSEE_1. REMIT_TO_ADDRESSEE_2, REMIT_TO_ADVICE_NAME, REMIT_TO_PAYEE.
     * Valid values for Customer are: REMIT_TO_ADDRESSEE_1. REMIT_TO_ADDRESSEE_2, REMIT_TO_ADVICE_NAME, REMIT_TO_PAYEE, BILL_TO_ADDRESSEE_1, BILL_TO_ADDRESSEE_2
     * - maxOccurs: unbounded
     * @var \StructType\Alternate_Name_UsageObjectType[]
     */
    public $Alternate_Name_Usage_Reference;
    /**
     * The Delete
     * Meta information extracted from the WSDL
     * - documentation: True if the alternate name for the business entity is being deleted.
     * @var bool
     */
    public $Delete;
    /**
     * Constructor method for Business_Entity_Alternate_Name_WWS_DataType
     * @uses Business_Entity_Alternate_Name_WWS_DataType::setAlternate_Name()
     * @uses Business_Entity_Alternate_Name_WWS_DataType::setAlternate_Name_Usage_Reference()
     * @uses Business_Entity_Alternate_Name_WWS_DataType::setDelete()
     * @param string $alternate_Name
     * @param \StructType\Alternate_Name_UsageObjectType[] $alternate_Name_Usage_Reference
     * @param bool $delete
     */
    public function __construct($alternate_Name = null, array $alternate_Name_Usage_Reference = array(), $delete = null)
    {
        $this
            ->setAlternate_Name($alternate_Name)
            ->setAlternate_Name_Usage_Reference($alternate_Name_Usage_Reference)
            ->setDelete($delete);
    }
    /**
     * Get Alternate_Name value
     * @return string|null
     */
    public function getAlternate_Name()
    {
        return $this->Alternate_Name;
    }
    /**
     * Set Alternate_Name value
     * @param string $alternate_Name
     * @return \StructType\Business_Entity_Alternate_Name_WWS_DataType
     */
    public function setAlternate_Name($alternate_Name = null)
    {
        // validation for constraint: string
        if (!is_null($alternate_Name) && !is_string($alternate_Name)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($alternate_Name, true), gettype($alternate_Name)), __LINE__);
        }
        $this->Alternate_Name = $alternate_Name;
        return $this;
    }
    /**
     * Get Alternate_Name_Usage_Reference value
     * @return \StructType\Alternate_Name_UsageObjectType[]|null
     */
    public function getAlternate_Name_Usage_Reference()
    {
        return $this->Alternate_Name_Usage_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setAlternate_Name_Usage_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setAlternate_Name_Usage_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateAlternate_Name_Usage_ReferenceForArrayConstraintsFromSetAlternate_Name_Usage_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $business_Entity_Alternate_Name_WWS_DataTypeAlternate_Name_Usage_ReferenceItem) {
            // validation for constraint: itemType
            if (!$business_Entity_Alternate_Name_WWS_DataTypeAlternate_Name_Usage_ReferenceItem instanceof \StructType\Alternate_Name_UsageObjectType) {
                $invalidValues[] = is_object($business_Entity_Alternate_Name_WWS_DataTypeAlternate_Name_Usage_ReferenceItem) ? get_class($business_Entity_Alternate_Name_WWS_DataTypeAlternate_Name_Usage_ReferenceItem) : sprintf('%s(%s)', gettype($business_Entity_Alternate_Name_WWS_DataTypeAlternate_Name_Usage_ReferenceItem), var_export($business_Entity_Alternate_Name_WWS_DataTypeAlternate_Name_Usage_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Alternate_Name_Usage_Reference property can only contain items of type \StructType\Alternate_Name_UsageObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Alternate_Name_Usage_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Alternate_Name_UsageObjectType[] $alternate_Name_Usage_Reference
     * @return \StructType\Business_Entity_Alternate_Name_WWS_DataType
     */
    public function setAlternate_Name_Usage_Reference(array $alternate_Name_Usage_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($alternate_Name_Usage_ReferenceArrayErrorMessage = self::validateAlternate_Name_Usage_ReferenceForArrayConstraintsFromSetAlternate_Name_Usage_Reference($alternate_Name_Usage_Reference))) {
            throw new \InvalidArgumentException($alternate_Name_Usage_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Alternate_Name_Usage_Reference = $alternate_Name_Usage_Reference;
        return $this;
    }
    /**
     * Add item to Alternate_Name_Usage_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Alternate_Name_UsageObjectType $item
     * @return \StructType\Business_Entity_Alternate_Name_WWS_DataType
     */
    public function addToAlternate_Name_Usage_Reference(\StructType\Alternate_Name_UsageObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Alternate_Name_UsageObjectType) {
            throw new \InvalidArgumentException(sprintf('The Alternate_Name_Usage_Reference property can only contain items of type \StructType\Alternate_Name_UsageObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Alternate_Name_Usage_Reference[] = $item;
        return $this;
    }
    /**
     * Get Delete value
     * @return bool|null
     */
    public function getDelete()
    {
        return $this->Delete;
    }
    /**
     * Set Delete value
     * @param bool $delete
     * @return \StructType\Business_Entity_Alternate_Name_WWS_DataType
     */
    public function setDelete($delete = null)
    {
        // validation for constraint: boolean
        if (!is_null($delete) && !is_bool($delete)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($delete, true), gettype($delete)), __LINE__);
        }
        $this->Delete = $delete;
        return $this;
    }
}
