<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for
 * Recruiting_Assessment_Category_Security_Segment_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing data for the Recruiting Assessment Category Security Segment.
 * @subpackage Structs
 */
class Recruiting_Assessment_Category_Security_Segment_Response_DataType extends AbstractStructBase
{
    /**
     * The Recruiting_Assessment_Category_Security_Segment
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Recruiting_Assessment_Category_Security_SegmentType[]
     */
    public $Recruiting_Assessment_Category_Security_Segment;
    /**
     * Constructor method for
     * Recruiting_Assessment_Category_Security_Segment_Response_DataType
     * @uses Recruiting_Assessment_Category_Security_Segment_Response_DataType::setRecruiting_Assessment_Category_Security_Segment()
     * @param \StructType\Recruiting_Assessment_Category_Security_SegmentType[] $recruiting_Assessment_Category_Security_Segment
     */
    public function __construct(array $recruiting_Assessment_Category_Security_Segment = array())
    {
        $this
            ->setRecruiting_Assessment_Category_Security_Segment($recruiting_Assessment_Category_Security_Segment);
    }
    /**
     * Get Recruiting_Assessment_Category_Security_Segment value
     * @return \StructType\Recruiting_Assessment_Category_Security_SegmentType[]|null
     */
    public function getRecruiting_Assessment_Category_Security_Segment()
    {
        return $this->Recruiting_Assessment_Category_Security_Segment;
    }
    /**
     * This method is responsible for validating the values passed to the setRecruiting_Assessment_Category_Security_Segment method
     * This method is willingly generated in order to preserve the one-line inline validation within the setRecruiting_Assessment_Category_Security_Segment method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateRecruiting_Assessment_Category_Security_SegmentForArrayConstraintsFromSetRecruiting_Assessment_Category_Security_Segment(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $recruiting_Assessment_Category_Security_Segment_Response_DataTypeRecruiting_Assessment_Category_Security_SegmentItem) {
            // validation for constraint: itemType
            if (!$recruiting_Assessment_Category_Security_Segment_Response_DataTypeRecruiting_Assessment_Category_Security_SegmentItem instanceof \StructType\Recruiting_Assessment_Category_Security_SegmentType) {
                $invalidValues[] = is_object($recruiting_Assessment_Category_Security_Segment_Response_DataTypeRecruiting_Assessment_Category_Security_SegmentItem) ? get_class($recruiting_Assessment_Category_Security_Segment_Response_DataTypeRecruiting_Assessment_Category_Security_SegmentItem) : sprintf('%s(%s)', gettype($recruiting_Assessment_Category_Security_Segment_Response_DataTypeRecruiting_Assessment_Category_Security_SegmentItem), var_export($recruiting_Assessment_Category_Security_Segment_Response_DataTypeRecruiting_Assessment_Category_Security_SegmentItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Recruiting_Assessment_Category_Security_Segment property can only contain items of type \StructType\Recruiting_Assessment_Category_Security_SegmentType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Recruiting_Assessment_Category_Security_Segment value
     * @throws \InvalidArgumentException
     * @param \StructType\Recruiting_Assessment_Category_Security_SegmentType[] $recruiting_Assessment_Category_Security_Segment
     * @return \StructType\Recruiting_Assessment_Category_Security_Segment_Response_DataType
     */
    public function setRecruiting_Assessment_Category_Security_Segment(array $recruiting_Assessment_Category_Security_Segment = array())
    {
        // validation for constraint: array
        if ('' !== ($recruiting_Assessment_Category_Security_SegmentArrayErrorMessage = self::validateRecruiting_Assessment_Category_Security_SegmentForArrayConstraintsFromSetRecruiting_Assessment_Category_Security_Segment($recruiting_Assessment_Category_Security_Segment))) {
            throw new \InvalidArgumentException($recruiting_Assessment_Category_Security_SegmentArrayErrorMessage, __LINE__);
        }
        $this->Recruiting_Assessment_Category_Security_Segment = $recruiting_Assessment_Category_Security_Segment;
        return $this;
    }
    /**
     * Add item to Recruiting_Assessment_Category_Security_Segment value
     * @throws \InvalidArgumentException
     * @param \StructType\Recruiting_Assessment_Category_Security_SegmentType $item
     * @return \StructType\Recruiting_Assessment_Category_Security_Segment_Response_DataType
     */
    public function addToRecruiting_Assessment_Category_Security_Segment(\StructType\Recruiting_Assessment_Category_Security_SegmentType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Recruiting_Assessment_Category_Security_SegmentType) {
            throw new \InvalidArgumentException(sprintf('The Recruiting_Assessment_Category_Security_Segment property can only contain items of type \StructType\Recruiting_Assessment_Category_Security_SegmentType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Recruiting_Assessment_Category_Security_Segment[] = $item;
        return $this;
    }
}
