<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Job_Requisition_AttachmentsType StructType
 * Meta information extracted from the WSDL
 * - documentation: Wrapper element for file Attachments for Job Requisition
 * @subpackage Structs
 */
class Job_Requisition_AttachmentsType extends AbstractStructBase
{
    /**
     * The Job_Requisition_Attachment_Data
     * Meta information extracted from the WSDL
     * - documentation: Wrapper element for a single file attachment
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Job_Requisition_Attachment_DataType[]
     */
    public $Job_Requisition_Attachment_Data;
    /**
     * Constructor method for Job_Requisition_AttachmentsType
     * @uses Job_Requisition_AttachmentsType::setJob_Requisition_Attachment_Data()
     * @param \StructType\Job_Requisition_Attachment_DataType[] $job_Requisition_Attachment_Data
     */
    public function __construct(array $job_Requisition_Attachment_Data = array())
    {
        $this
            ->setJob_Requisition_Attachment_Data($job_Requisition_Attachment_Data);
    }
    /**
     * Get Job_Requisition_Attachment_Data value
     * @return \StructType\Job_Requisition_Attachment_DataType[]|null
     */
    public function getJob_Requisition_Attachment_Data()
    {
        return $this->Job_Requisition_Attachment_Data;
    }
    /**
     * This method is responsible for validating the values passed to the setJob_Requisition_Attachment_Data method
     * This method is willingly generated in order to preserve the one-line inline validation within the setJob_Requisition_Attachment_Data method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateJob_Requisition_Attachment_DataForArrayConstraintsFromSetJob_Requisition_Attachment_Data(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $job_Requisition_AttachmentsTypeJob_Requisition_Attachment_DataItem) {
            // validation for constraint: itemType
            if (!$job_Requisition_AttachmentsTypeJob_Requisition_Attachment_DataItem instanceof \StructType\Job_Requisition_Attachment_DataType) {
                $invalidValues[] = is_object($job_Requisition_AttachmentsTypeJob_Requisition_Attachment_DataItem) ? get_class($job_Requisition_AttachmentsTypeJob_Requisition_Attachment_DataItem) : sprintf('%s(%s)', gettype($job_Requisition_AttachmentsTypeJob_Requisition_Attachment_DataItem), var_export($job_Requisition_AttachmentsTypeJob_Requisition_Attachment_DataItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Job_Requisition_Attachment_Data property can only contain items of type \StructType\Job_Requisition_Attachment_DataType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Job_Requisition_Attachment_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Job_Requisition_Attachment_DataType[] $job_Requisition_Attachment_Data
     * @return \StructType\Job_Requisition_AttachmentsType
     */
    public function setJob_Requisition_Attachment_Data(array $job_Requisition_Attachment_Data = array())
    {
        // validation for constraint: array
        if ('' !== ($job_Requisition_Attachment_DataArrayErrorMessage = self::validateJob_Requisition_Attachment_DataForArrayConstraintsFromSetJob_Requisition_Attachment_Data($job_Requisition_Attachment_Data))) {
            throw new \InvalidArgumentException($job_Requisition_Attachment_DataArrayErrorMessage, __LINE__);
        }
        $this->Job_Requisition_Attachment_Data = $job_Requisition_Attachment_Data;
        return $this;
    }
    /**
     * Add item to Job_Requisition_Attachment_Data value
     * @throws \InvalidArgumentException
     * @param \StructType\Job_Requisition_Attachment_DataType $item
     * @return \StructType\Job_Requisition_AttachmentsType
     */
    public function addToJob_Requisition_Attachment_Data(\StructType\Job_Requisition_Attachment_DataType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Job_Requisition_Attachment_DataType) {
            throw new \InvalidArgumentException(sprintf('The Job_Requisition_Attachment_Data property can only contain items of type \StructType\Job_Requisition_Attachment_DataType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Job_Requisition_Attachment_Data[] = $item;
        return $this;
    }
}
