<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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