<?php

namespace hp_;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for THpSvcWTableauClesPromotions StructType
 * @subpackage Structs
 */
class THpSvcWTableauClesPromotions extends AbstractStructBase
{
    /**
     * The THpSvcWClePromotion
     * Meta information extracted from the WSDL
     * - base: xsd:unsignedInt
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var int[]
     */
    public $THpSvcWClePromotion;
    /**
     * Constructor method for THpSvcWTableauClesPromotions
     * @uses THpSvcWTableauClesPromotions::setTHpSvcWClePromotion()
     * @param int[] $tHpSvcWClePromotion
     */
    public function __construct(array $tHpSvcWClePromotion = array())
    {
        $this
            ->setTHpSvcWClePromotion($tHpSvcWClePromotion);
    }
    /**
     * Get THpSvcWClePromotion value
     * @return int[]|null
     */
    public function getTHpSvcWClePromotion()
    {
        return $this->THpSvcWClePromotion;
    }
    /**
     * This method is responsible for validating the values passed to the setTHpSvcWClePromotion method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTHpSvcWClePromotion method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTHpSvcWClePromotionForArrayConstraintsFromSetTHpSvcWClePromotion(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $tHpSvcWTableauClesPromotionsTHpSvcWClePromotionItem) {
            // validation for constraint: itemType
            if (!(is_int($tHpSvcWTableauClesPromotionsTHpSvcWClePromotionItem) || ctype_digit($tHpSvcWTableauClesPromotionsTHpSvcWClePromotionItem))) {
                $invalidValues[] = is_object($tHpSvcWTableauClesPromotionsTHpSvcWClePromotionItem) ? get_class($tHpSvcWTableauClesPromotionsTHpSvcWClePromotionItem) : sprintf('%s(%s)', gettype($tHpSvcWTableauClesPromotionsTHpSvcWClePromotionItem), var_export($tHpSvcWTableauClesPromotionsTHpSvcWClePromotionItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The THpSvcWClePromotion property can only contain items of type unsignedInt, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set THpSvcWClePromotion value
     * @throws \InvalidArgumentException
     * @param int[] $tHpSvcWClePromotion
     * @return \hp_\THpSvcWTableauClesPromotions
     */
    public function setTHpSvcWClePromotion(array $tHpSvcWClePromotion = array())
    {
        // validation for constraint: array
        if ('' !== ($tHpSvcWClePromotionArrayErrorMessage = self::validateTHpSvcWClePromotionForArrayConstraintsFromSetTHpSvcWClePromotion($tHpSvcWClePromotion))) {
            throw new \InvalidArgumentException($tHpSvcWClePromotionArrayErrorMessage, __LINE__);
        }
        $this->THpSvcWClePromotion = $tHpSvcWClePromotion;
        return $this;
    }
    /**
     * Add item to THpSvcWClePromotion value
     * @throws \InvalidArgumentException
     * @param int $item
     * @return \hp_\THpSvcWTableauClesPromotions
     */
    public function addToTHpSvcWClePromotion($item)
    {
        // validation for constraint: itemType
        if (!(is_int($item) || ctype_digit($item))) {
            throw new \InvalidArgumentException(sprintf('The THpSvcWClePromotion property can only contain items of type unsignedInt, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->THpSvcWClePromotion[] = $item;
        return $this;
    }
}
