<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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