<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Business_Entity_Contact_Type_Tenanted_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Business Entity Contact Type Tenanted for Business Entity Contact
 * @subpackage Structs
 */
class Business_Entity_Contact_Type_Tenanted_DataType extends AbstractStructBase
{
    /**
     * The Contact_Type_Tenanted_Reference
     * Meta information extracted from the WSDL
     * - documentation: Business Entity Contact Type Tenanted
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Business_Entity_Contact_Type_TenantedObjectType[]
     */
    public $Contact_Type_Tenanted_Reference;
    /**
     * The Business_Entity_Contact_Type_Reference
     * Meta information extracted from the WSDL
     * - documentation: Business Entity Contact Type Reference
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Business_Entity_Contact_TypeObjectType[]
     */
    public $Business_Entity_Contact_Type_Reference;
    /**
     * Constructor method for Business_Entity_Contact_Type_Tenanted_DataType
     * @uses Business_Entity_Contact_Type_Tenanted_DataType::setContact_Type_Tenanted_Reference()
     * @uses Business_Entity_Contact_Type_Tenanted_DataType::setBusiness_Entity_Contact_Type_Reference()
     * @param \StructType\Business_Entity_Contact_Type_TenantedObjectType[] $contact_Type_Tenanted_Reference
     * @param \StructType\Business_Entity_Contact_TypeObjectType[] $business_Entity_Contact_Type_Reference
     */
    public function __construct(array $contact_Type_Tenanted_Reference = array(), array $business_Entity_Contact_Type_Reference = array())
    {
        $this
            ->setContact_Type_Tenanted_Reference($contact_Type_Tenanted_Reference)
            ->setBusiness_Entity_Contact_Type_Reference($business_Entity_Contact_Type_Reference);
    }
    /**
     * Get Contact_Type_Tenanted_Reference value
     * @return \StructType\Business_Entity_Contact_Type_TenantedObjectType[]|null
     */
    public function getContact_Type_Tenanted_Reference()
    {
        return $this->Contact_Type_Tenanted_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setContact_Type_Tenanted_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setContact_Type_Tenanted_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateContact_Type_Tenanted_ReferenceForArrayConstraintsFromSetContact_Type_Tenanted_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $business_Entity_Contact_Type_Tenanted_DataTypeContact_Type_Tenanted_ReferenceItem) {
            // validation for constraint: itemType
            if (!$business_Entity_Contact_Type_Tenanted_DataTypeContact_Type_Tenanted_ReferenceItem instanceof \StructType\Business_Entity_Contact_Type_TenantedObjectType) {
                $invalidValues[] = is_object($business_Entity_Contact_Type_Tenanted_DataTypeContact_Type_Tenanted_ReferenceItem) ? get_class($business_Entity_Contact_Type_Tenanted_DataTypeContact_Type_Tenanted_ReferenceItem) : sprintf('%s(%s)', gettype($business_Entity_Contact_Type_Tenanted_DataTypeContact_Type_Tenanted_ReferenceItem), var_export($business_Entity_Contact_Type_Tenanted_DataTypeContact_Type_Tenanted_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Contact_Type_Tenanted_Reference property can only contain items of type \StructType\Business_Entity_Contact_Type_TenantedObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Contact_Type_Tenanted_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Business_Entity_Contact_Type_TenantedObjectType[] $contact_Type_Tenanted_Reference
     * @return \StructType\Business_Entity_Contact_Type_Tenanted_DataType
     */
    public function setContact_Type_Tenanted_Reference(array $contact_Type_Tenanted_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($contact_Type_Tenanted_ReferenceArrayErrorMessage = self::validateContact_Type_Tenanted_ReferenceForArrayConstraintsFromSetContact_Type_Tenanted_Reference($contact_Type_Tenanted_Reference))) {
            throw new \InvalidArgumentException($contact_Type_Tenanted_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Contact_Type_Tenanted_Reference = $contact_Type_Tenanted_Reference;
        return $this;
    }
    /**
     * Add item to Contact_Type_Tenanted_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Business_Entity_Contact_Type_TenantedObjectType $item
     * @return \StructType\Business_Entity_Contact_Type_Tenanted_DataType
     */
    public function addToContact_Type_Tenanted_Reference(\StructType\Business_Entity_Contact_Type_TenantedObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Business_Entity_Contact_Type_TenantedObjectType) {
            throw new \InvalidArgumentException(sprintf('The Contact_Type_Tenanted_Reference property can only contain items of type \StructType\Business_Entity_Contact_Type_TenantedObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Contact_Type_Tenanted_Reference[] = $item;
        return $this;
    }
    /**
     * Get Business_Entity_Contact_Type_Reference value
     * @return \StructType\Business_Entity_Contact_TypeObjectType[]|null
     */
    public function getBusiness_Entity_Contact_Type_Reference()
    {
        return $this->Business_Entity_Contact_Type_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setBusiness_Entity_Contact_Type_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setBusiness_Entity_Contact_Type_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateBusiness_Entity_Contact_Type_ReferenceForArrayConstraintsFromSetBusiness_Entity_Contact_Type_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $business_Entity_Contact_Type_Tenanted_DataTypeBusiness_Entity_Contact_Type_ReferenceItem) {
            // validation for constraint: itemType
            if (!$business_Entity_Contact_Type_Tenanted_DataTypeBusiness_Entity_Contact_Type_ReferenceItem instanceof \StructType\Business_Entity_Contact_TypeObjectType) {
                $invalidValues[] = is_object($business_Entity_Contact_Type_Tenanted_DataTypeBusiness_Entity_Contact_Type_ReferenceItem) ? get_class($business_Entity_Contact_Type_Tenanted_DataTypeBusiness_Entity_Contact_Type_ReferenceItem) : sprintf('%s(%s)', gettype($business_Entity_Contact_Type_Tenanted_DataTypeBusiness_Entity_Contact_Type_ReferenceItem), var_export($business_Entity_Contact_Type_Tenanted_DataTypeBusiness_Entity_Contact_Type_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Business_Entity_Contact_Type_Reference property can only contain items of type \StructType\Business_Entity_Contact_TypeObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Business_Entity_Contact_Type_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Business_Entity_Contact_TypeObjectType[] $business_Entity_Contact_Type_Reference
     * @return \StructType\Business_Entity_Contact_Type_Tenanted_DataType
     */
    public function setBusiness_Entity_Contact_Type_Reference(array $business_Entity_Contact_Type_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($business_Entity_Contact_Type_ReferenceArrayErrorMessage = self::validateBusiness_Entity_Contact_Type_ReferenceForArrayConstraintsFromSetBusiness_Entity_Contact_Type_Reference($business_Entity_Contact_Type_Reference))) {
            throw new \InvalidArgumentException($business_Entity_Contact_Type_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Business_Entity_Contact_Type_Reference = $business_Entity_Contact_Type_Reference;
        return $this;
    }
    /**
     * Add item to Business_Entity_Contact_Type_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Business_Entity_Contact_TypeObjectType $item
     * @return \StructType\Business_Entity_Contact_Type_Tenanted_DataType
     */
    public function addToBusiness_Entity_Contact_Type_Reference(\StructType\Business_Entity_Contact_TypeObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Business_Entity_Contact_TypeObjectType) {
            throw new \InvalidArgumentException(sprintf('The Business_Entity_Contact_Type_Reference property can only contain items of type \StructType\Business_Entity_Contact_TypeObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Business_Entity_Contact_Type_Reference[] = $item;
        return $this;
    }
}
