<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Candidate_Pool_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Candidate pool data for the candidate.
 * @subpackage Structs
 */
class Candidate_Pool_DataType extends AbstractStructBase
{
    /**
     * The Candidate_Pool_Membership_Data
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Candidate_Pool_Membership_DataType[]
     */
    public $Candidate_Pool_Membership_Data;
    /**
     * Constructor method for Candidate_Pool_DataType
     * @uses Candidate_Pool_DataType::setCandidate_Pool_Membership_Data()
     * @param \StructType\Candidate_Pool_Membership_DataType[] $candidate_Pool_Membership_Data
     */
    public function __construct(array $candidate_Pool_Membership_Data = array())
    {
        $this
            ->setCandidate_Pool_Membership_Data($candidate_Pool_Membership_Data);
    }
    /**
     * Get Candidate_Pool_Membership_Data value
     * @return \StructType\Candidate_Pool_Membership_DataType[]|null
     */
    public function getCandidate_Pool_Membership_Data()
    {
        return $this->Candidate_Pool_Membership_Data;
    }
    /**
     * This method is responsible for validating the values passed to the setCandidate_Pool_Membership_Data method
     * This method is willingly generated in order to preserve the one-line inline validation within the setCandidate_Pool_Membership_Data method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateCandidate_Pool_Membership_DataForArrayConstraintsFromSetCandidate_Pool_Membership_Data(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $candidate_Pool_DataTypeCandidate_Pool_Membership_DataItem) {
            // validation for constraint: itemType
            if (!$candidate_Pool_DataTypeCandidate_Pool_Membership_DataItem instanceof \StructType\Candidate_Pool_Membership_DataType) {
                $invalidValues[] = is_object($candidate_Pool_DataTypeCandidate_Pool_Membership_DataItem) ? get_class($candidate_Pool_DataTypeCandidate_Pool_Membership_DataItem) : sprintf('%s(%s)', gettype($candidate_Pool_DataTypeCandidate_Pool_Membership_DataItem), var_export($candidate_Pool_DataTypeCandidate_Pool_Membership_DataItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Candidate_Pool_Membership_Data property can only contain items of type \StructType\Candidate_Pool_Membership_DataType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Candidate_Pool_Membership_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Candidate_Pool_Membership_DataType[] $candidate_Pool_Membership_Data
     * @return \StructType\Candidate_Pool_DataType
     */
    public function setCandidate_Pool_Membership_Data(array $candidate_Pool_Membership_Data = array())
    {
        // validation for constraint: array
        if ('' !== ($candidate_Pool_Membership_DataArrayErrorMessage = self::validateCandidate_Pool_Membership_DataForArrayConstraintsFromSetCandidate_Pool_Membership_Data($candidate_Pool_Membership_Data))) {
            throw new \InvalidArgumentException($candidate_Pool_Membership_DataArrayErrorMessage, __LINE__);
        }
        $this->Candidate_Pool_Membership_Data = $candidate_Pool_Membership_Data;
        return $this;
    }
    /**
     * Add item to Candidate_Pool_Membership_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Candidate_Pool_Membership_DataType $item
     * @return \StructType\Candidate_Pool_DataType
     */
    public function addToCandidate_Pool_Membership_Data(\StructType\Candidate_Pool_Membership_DataType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Candidate_Pool_Membership_DataType) {
            throw new \InvalidArgumentException(sprintf('The Candidate_Pool_Membership_Data property can only contain items of type \StructType\Candidate_Pool_Membership_DataType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Candidate_Pool_Membership_Data[] = $item;
        return $this;
    }
}
