<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Location_Customer_Account_Number_Detail_Response_DataType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing Location Customer Account Number Details response data for requested references.
 * @subpackage Structs
 */
class Location_Customer_Account_Number_Detail_Response_DataType extends AbstractStructBase
{
    /**
     * The Location_Customer_Account_Number_Detail
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Location_Customer_Account_Number_DetailType[]
     */
    public $Location_Customer_Account_Number_Detail;
    /**
     * Constructor method for Location_Customer_Account_Number_Detail_Response_DataType
     * @uses Location_Customer_Account_Number_Detail_Response_DataType::setLocation_Customer_Account_Number_Detail()
     * @param \StructType\Location_Customer_Account_Number_DetailType[] $location_Customer_Account_Number_Detail
     */
    public function __construct(array $location_Customer_Account_Number_Detail = array())
    {
        $this
            ->setLocation_Customer_Account_Number_Detail($location_Customer_Account_Number_Detail);
    }
    /**
     * Get Location_Customer_Account_Number_Detail value
     * @return \StructType\Location_Customer_Account_Number_DetailType[]|null
     */
    public function getLocation_Customer_Account_Number_Detail()
    {
        return $this->Location_Customer_Account_Number_Detail;
    }
    /**
     * This method is responsible for validating the values passed to the setLocation_Customer_Account_Number_Detail method
     * This method is willingly generated in order to preserve the one-line inline validation within the setLocation_Customer_Account_Number_Detail method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateLocation_Customer_Account_Number_DetailForArrayConstraintsFromSetLocation_Customer_Account_Number_Detail(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $location_Customer_Account_Number_Detail_Response_DataTypeLocation_Customer_Account_Number_DetailItem) {
            // validation for constraint: itemType
            if (!$location_Customer_Account_Number_Detail_Response_DataTypeLocation_Customer_Account_Number_DetailItem instanceof \StructType\Location_Customer_Account_Number_DetailType) {
                $invalidValues[] = is_object($location_Customer_Account_Number_Detail_Response_DataTypeLocation_Customer_Account_Number_DetailItem) ? get_class($location_Customer_Account_Number_Detail_Response_DataTypeLocation_Customer_Account_Number_DetailItem) : sprintf('%s(%s)', gettype($location_Customer_Account_Number_Detail_Response_DataTypeLocation_Customer_Account_Number_DetailItem), var_export($location_Customer_Account_Number_Detail_Response_DataTypeLocation_Customer_Account_Number_DetailItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Location_Customer_Account_Number_Detail property can only contain items of type \StructType\Location_Customer_Account_Number_DetailType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Location_Customer_Account_Number_Detail value
     * @throws \InvalidArgumentException
     * @param \StructType\Location_Customer_Account_Number_DetailType[] $location_Customer_Account_Number_Detail
     * @return \StructType\Location_Customer_Account_Number_Detail_Response_DataType
     */
    public function setLocation_Customer_Account_Number_Detail(array $location_Customer_Account_Number_Detail = array())
    {
        // validation for constraint: array
        if ('' !== ($location_Customer_Account_Number_DetailArrayErrorMessage = self::validateLocation_Customer_Account_Number_DetailForArrayConstraintsFromSetLocation_Customer_Account_Number_Detail($location_Customer_Account_Number_Detail))) {
            throw new \InvalidArgumentException($location_Customer_Account_Number_DetailArrayErrorMessage, __LINE__);
        }
        $this->Location_Customer_Account_Number_Detail = $location_Customer_Account_Number_Detail;
        return $this;
    }
    /**
     * Add item to Location_Customer_Account_Number_Detail value
     * @throws \InvalidArgumentException
     * @param \StructType\Location_Customer_Account_Number_DetailType $item
     * @return \StructType\Location_Customer_Account_Number_Detail_Response_DataType
     */
    public function addToLocation_Customer_Account_Number_Detail(\StructType\Location_Customer_Account_Number_DetailType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Location_Customer_Account_Number_DetailType) {
            throw new \InvalidArgumentException(sprintf('The Location_Customer_Account_Number_Detail property can only contain items of type \StructType\Location_Customer_Account_Number_DetailType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Location_Customer_Account_Number_Detail[] = $item;
        return $this;
    }
}
