<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for PriceLevelSearchRowBasic StructType
 * @subpackage Structs
 */
class PriceLevelSearchRowBasic extends SearchRowBasic
{
    /**
     * The discountPct
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnDoubleField[]
     */
    public $discountPct;
    /**
     * The externalId
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnSelectField[]
     */
    public $externalId;
    /**
     * The internalId
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnSelectField[]
     */
    public $internalId;
    /**
     * The isInactive
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnBooleanField[]
     */
    public $isInactive;
    /**
     * The isOnline
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnBooleanField[]
     */
    public $isOnline;
    /**
     * The name
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\SearchColumnStringField[]
     */
    public $name;
    /**
     * Constructor method for PriceLevelSearchRowBasic
     * @uses PriceLevelSearchRowBasic::setDiscountPct()
     * @uses PriceLevelSearchRowBasic::setExternalId()
     * @uses PriceLevelSearchRowBasic::setInternalId()
     * @uses PriceLevelSearchRowBasic::setIsInactive()
     * @uses PriceLevelSearchRowBasic::setIsOnline()
     * @uses PriceLevelSearchRowBasic::setName()
     * @param \StructType\SearchColumnDoubleField[] $discountPct
     * @param \StructType\SearchColumnSelectField[] $externalId
     * @param \StructType\SearchColumnSelectField[] $internalId
     * @param \StructType\SearchColumnBooleanField[] $isInactive
     * @param \StructType\SearchColumnBooleanField[] $isOnline
     * @param \StructType\SearchColumnStringField[] $name
     */
    public function __construct(array $discountPct = array(), array $externalId = array(), array $internalId = array(), array $isInactive = array(), array $isOnline = array(), array $name = array())
    {
        $this
            ->setDiscountPct($discountPct)
            ->setExternalId($externalId)
            ->setInternalId($internalId)
            ->setIsInactive($isInactive)
            ->setIsOnline($isOnline)
            ->setName($name);
    }
    /**
     * Get discountPct value
     * @return \StructType\SearchColumnDoubleField[]|null
     */
    public function getDiscountPct()
    {
        return $this->discountPct;
    }
    /**
     * This method is responsible for validating the values passed to the setDiscountPct method
     * This method is willingly generated in order to preserve the one-line inline validation within the setDiscountPct method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateDiscountPctForArrayConstraintsFromSetDiscountPct(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $priceLevelSearchRowBasicDiscountPctItem) {
            // validation for constraint: itemType
            if (!$priceLevelSearchRowBasicDiscountPctItem instanceof \StructType\SearchColumnDoubleField) {
                $invalidValues[] = is_object($priceLevelSearchRowBasicDiscountPctItem) ? get_class($priceLevelSearchRowBasicDiscountPctItem) : sprintf('%s(%s)', gettype($priceLevelSearchRowBasicDiscountPctItem), var_export($priceLevelSearchRowBasicDiscountPctItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The discountPct property can only contain items of type \StructType\SearchColumnDoubleField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set discountPct value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnDoubleField[] $discountPct
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function setDiscountPct(array $discountPct = array())
    {
        // validation for constraint: array
        if ('' !== ($discountPctArrayErrorMessage = self::validateDiscountPctForArrayConstraintsFromSetDiscountPct($discountPct))) {
            throw new \InvalidArgumentException($discountPctArrayErrorMessage, __LINE__);
        }
        $this->discountPct = $discountPct;
        return $this;
    }
    /**
     * Add item to discountPct value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnDoubleField $item
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function addToDiscountPct(\StructType\SearchColumnDoubleField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnDoubleField) {
            throw new \InvalidArgumentException(sprintf('The discountPct property can only contain items of type \StructType\SearchColumnDoubleField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->discountPct[] = $item;
        return $this;
    }
    /**
     * Get externalId value
     * @return \StructType\SearchColumnSelectField[]|null
     */
    public function getExternalId()
    {
        return $this->externalId;
    }
    /**
     * This method is responsible for validating the values passed to the setExternalId method
     * This method is willingly generated in order to preserve the one-line inline validation within the setExternalId method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateExternalIdForArrayConstraintsFromSetExternalId(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $priceLevelSearchRowBasicExternalIdItem) {
            // validation for constraint: itemType
            if (!$priceLevelSearchRowBasicExternalIdItem instanceof \StructType\SearchColumnSelectField) {
                $invalidValues[] = is_object($priceLevelSearchRowBasicExternalIdItem) ? get_class($priceLevelSearchRowBasicExternalIdItem) : sprintf('%s(%s)', gettype($priceLevelSearchRowBasicExternalIdItem), var_export($priceLevelSearchRowBasicExternalIdItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The externalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set externalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField[] $externalId
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function setExternalId(array $externalId = array())
    {
        // validation for constraint: array
        if ('' !== ($externalIdArrayErrorMessage = self::validateExternalIdForArrayConstraintsFromSetExternalId($externalId))) {
            throw new \InvalidArgumentException($externalIdArrayErrorMessage, __LINE__);
        }
        $this->externalId = $externalId;
        return $this;
    }
    /**
     * Add item to externalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField $item
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function addToExternalId(\StructType\SearchColumnSelectField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnSelectField) {
            throw new \InvalidArgumentException(sprintf('The externalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->externalId[] = $item;
        return $this;
    }
    /**
     * Get internalId value
     * @return \StructType\SearchColumnSelectField[]|null
     */
    public function getInternalId()
    {
        return $this->internalId;
    }
    /**
     * This method is responsible for validating the values passed to the setInternalId method
     * This method is willingly generated in order to preserve the one-line inline validation within the setInternalId method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateInternalIdForArrayConstraintsFromSetInternalId(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $priceLevelSearchRowBasicInternalIdItem) {
            // validation for constraint: itemType
            if (!$priceLevelSearchRowBasicInternalIdItem instanceof \StructType\SearchColumnSelectField) {
                $invalidValues[] = is_object($priceLevelSearchRowBasicInternalIdItem) ? get_class($priceLevelSearchRowBasicInternalIdItem) : sprintf('%s(%s)', gettype($priceLevelSearchRowBasicInternalIdItem), var_export($priceLevelSearchRowBasicInternalIdItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The internalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set internalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField[] $internalId
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function setInternalId(array $internalId = array())
    {
        // validation for constraint: array
        if ('' !== ($internalIdArrayErrorMessage = self::validateInternalIdForArrayConstraintsFromSetInternalId($internalId))) {
            throw new \InvalidArgumentException($internalIdArrayErrorMessage, __LINE__);
        }
        $this->internalId = $internalId;
        return $this;
    }
    /**
     * Add item to internalId value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnSelectField $item
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function addToInternalId(\StructType\SearchColumnSelectField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnSelectField) {
            throw new \InvalidArgumentException(sprintf('The internalId property can only contain items of type \StructType\SearchColumnSelectField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->internalId[] = $item;
        return $this;
    }
    /**
     * Get isInactive value
     * @return \StructType\SearchColumnBooleanField[]|null
     */
    public function getIsInactive()
    {
        return $this->isInactive;
    }
    /**
     * This method is responsible for validating the values passed to the setIsInactive method
     * This method is willingly generated in order to preserve the one-line inline validation within the setIsInactive method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateIsInactiveForArrayConstraintsFromSetIsInactive(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $priceLevelSearchRowBasicIsInactiveItem) {
            // validation for constraint: itemType
            if (!$priceLevelSearchRowBasicIsInactiveItem instanceof \StructType\SearchColumnBooleanField) {
                $invalidValues[] = is_object($priceLevelSearchRowBasicIsInactiveItem) ? get_class($priceLevelSearchRowBasicIsInactiveItem) : sprintf('%s(%s)', gettype($priceLevelSearchRowBasicIsInactiveItem), var_export($priceLevelSearchRowBasicIsInactiveItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The isInactive property can only contain items of type \StructType\SearchColumnBooleanField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set isInactive value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnBooleanField[] $isInactive
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function setIsInactive(array $isInactive = array())
    {
        // validation for constraint: array
        if ('' !== ($isInactiveArrayErrorMessage = self::validateIsInactiveForArrayConstraintsFromSetIsInactive($isInactive))) {
            throw new \InvalidArgumentException($isInactiveArrayErrorMessage, __LINE__);
        }
        $this->isInactive = $isInactive;
        return $this;
    }
    /**
     * Add item to isInactive value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnBooleanField $item
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function addToIsInactive(\StructType\SearchColumnBooleanField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnBooleanField) {
            throw new \InvalidArgumentException(sprintf('The isInactive property can only contain items of type \StructType\SearchColumnBooleanField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->isInactive[] = $item;
        return $this;
    }
    /**
     * Get isOnline value
     * @return \StructType\SearchColumnBooleanField[]|null
     */
    public function getIsOnline()
    {
        return $this->isOnline;
    }
    /**
     * This method is responsible for validating the values passed to the setIsOnline method
     * This method is willingly generated in order to preserve the one-line inline validation within the setIsOnline method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateIsOnlineForArrayConstraintsFromSetIsOnline(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $priceLevelSearchRowBasicIsOnlineItem) {
            // validation for constraint: itemType
            if (!$priceLevelSearchRowBasicIsOnlineItem instanceof \StructType\SearchColumnBooleanField) {
                $invalidValues[] = is_object($priceLevelSearchRowBasicIsOnlineItem) ? get_class($priceLevelSearchRowBasicIsOnlineItem) : sprintf('%s(%s)', gettype($priceLevelSearchRowBasicIsOnlineItem), var_export($priceLevelSearchRowBasicIsOnlineItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The isOnline property can only contain items of type \StructType\SearchColumnBooleanField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set isOnline value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnBooleanField[] $isOnline
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function setIsOnline(array $isOnline = array())
    {
        // validation for constraint: array
        if ('' !== ($isOnlineArrayErrorMessage = self::validateIsOnlineForArrayConstraintsFromSetIsOnline($isOnline))) {
            throw new \InvalidArgumentException($isOnlineArrayErrorMessage, __LINE__);
        }
        $this->isOnline = $isOnline;
        return $this;
    }
    /**
     * Add item to isOnline value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnBooleanField $item
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function addToIsOnline(\StructType\SearchColumnBooleanField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnBooleanField) {
            throw new \InvalidArgumentException(sprintf('The isOnline property can only contain items of type \StructType\SearchColumnBooleanField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->isOnline[] = $item;
        return $this;
    }
    /**
     * Get name value
     * @return \StructType\SearchColumnStringField[]|null
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * This method is responsible for validating the values passed to the setName method
     * This method is willingly generated in order to preserve the one-line inline validation within the setName method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateNameForArrayConstraintsFromSetName(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $priceLevelSearchRowBasicNameItem) {
            // validation for constraint: itemType
            if (!$priceLevelSearchRowBasicNameItem instanceof \StructType\SearchColumnStringField) {
                $invalidValues[] = is_object($priceLevelSearchRowBasicNameItem) ? get_class($priceLevelSearchRowBasicNameItem) : sprintf('%s(%s)', gettype($priceLevelSearchRowBasicNameItem), var_export($priceLevelSearchRowBasicNameItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The name property can only contain items of type \StructType\SearchColumnStringField, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set name value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnStringField[] $name
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function setName(array $name = array())
    {
        // validation for constraint: array
        if ('' !== ($nameArrayErrorMessage = self::validateNameForArrayConstraintsFromSetName($name))) {
            throw new \InvalidArgumentException($nameArrayErrorMessage, __LINE__);
        }
        $this->name = $name;
        return $this;
    }
    /**
     * Add item to name value
     * @throws \InvalidArgumentException
     * @param \StructType\SearchColumnStringField $item
     * @return \StructType\PriceLevelSearchRowBasic
     */
    public function addToName(\StructType\SearchColumnStringField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\SearchColumnStringField) {
            throw new \InvalidArgumentException(sprintf('The name property can only contain items of type \StructType\SearchColumnStringField, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->name[] = $item;
        return $this;
    }
}
