<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Maintain_Candidate_List_Assignment_Response_DataType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: This contains the Candidate List Assignment Data Content
 * @subpackage Structs
 */
class Maintain_Candidate_List_Assignment_Response_DataType extends AbstractStructBase
{
    /**
     * The Maintain_Candidate_List_Assignment
     * Meta information extracted from the WSDL
     * - documentation: Contains the default grid and Rules
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Maintain_Candidate_List_Assignment_Get_DataType[]
     */
    public $Maintain_Candidate_List_Assignment;
    /**
     * Constructor method for Maintain_Candidate_List_Assignment_Response_DataType
     * @uses Maintain_Candidate_List_Assignment_Response_DataType::setMaintain_Candidate_List_Assignment()
     * @param \StructType\Maintain_Candidate_List_Assignment_Get_DataType[] $maintain_Candidate_List_Assignment
     */
    public function __construct(array $maintain_Candidate_List_Assignment = array())
    {
        $this
            ->setMaintain_Candidate_List_Assignment($maintain_Candidate_List_Assignment);
    }
    /**
     * Get Maintain_Candidate_List_Assignment value
     * @return \StructType\Maintain_Candidate_List_Assignment_Get_DataType[]|null
     */
    public function getMaintain_Candidate_List_Assignment()
    {
        return $this->Maintain_Candidate_List_Assignment;
    }
    /**
     * This method is responsible for validating the values passed to the setMaintain_Candidate_List_Assignment method
     * This method is willingly generated in order to preserve the one-line inline validation within the setMaintain_Candidate_List_Assignment method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateMaintain_Candidate_List_AssignmentForArrayConstraintsFromSetMaintain_Candidate_List_Assignment(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $maintain_Candidate_List_Assignment_Response_DataTypeMaintain_Candidate_List_AssignmentItem) {
            // validation for constraint: itemType
            if (!$maintain_Candidate_List_Assignment_Response_DataTypeMaintain_Candidate_List_AssignmentItem instanceof \StructType\Maintain_Candidate_List_Assignment_Get_DataType) {
                $invalidValues[] = is_object($maintain_Candidate_List_Assignment_Response_DataTypeMaintain_Candidate_List_AssignmentItem) ? get_class($maintain_Candidate_List_Assignment_Response_DataTypeMaintain_Candidate_List_AssignmentItem) : sprintf('%s(%s)', gettype($maintain_Candidate_List_Assignment_Response_DataTypeMaintain_Candidate_List_AssignmentItem), var_export($maintain_Candidate_List_Assignment_Response_DataTypeMaintain_Candidate_List_AssignmentItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Maintain_Candidate_List_Assignment property can only contain items of type \StructType\Maintain_Candidate_List_Assignment_Get_DataType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Maintain_Candidate_List_Assignment value
     * @throws \InvalidArgumentException
     * @param \StructType\Maintain_Candidate_List_Assignment_Get_DataType[] $maintain_Candidate_List_Assignment
     * @return \StructType\Maintain_Candidate_List_Assignment_Response_DataType
     */
    public function setMaintain_Candidate_List_Assignment(array $maintain_Candidate_List_Assignment = array())
    {
        // validation for constraint: array
        if ('' !== ($maintain_Candidate_List_AssignmentArrayErrorMessage = self::validateMaintain_Candidate_List_AssignmentForArrayConstraintsFromSetMaintain_Candidate_List_Assignment($maintain_Candidate_List_Assignment))) {
            throw new \InvalidArgumentException($maintain_Candidate_List_AssignmentArrayErrorMessage, __LINE__);
        }
        $this->Maintain_Candidate_List_Assignment = $maintain_Candidate_List_Assignment;
        return $this;
    }
    /**
     * Add item to Maintain_Candidate_List_Assignment value
     * @throws \InvalidArgumentException
     * @param \StructType\Maintain_Candidate_List_Assignment_Get_DataType $item
     * @return \StructType\Maintain_Candidate_List_Assignment_Response_DataType
     */
    public function addToMaintain_Candidate_List_Assignment(\StructType\Maintain_Candidate_List_Assignment_Get_DataType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Maintain_Candidate_List_Assignment_Get_DataType) {
            throw new \InvalidArgumentException(sprintf('The Maintain_Candidate_List_Assignment property can only contain items of type \StructType\Maintain_Candidate_List_Assignment_Get_DataType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Maintain_Candidate_List_Assignment[] = $item;
        return $this;
    }
}
