<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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