<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Job_Application_Template_Translation_Request_CriteriaType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: Contains reference to target language for translation
 * @subpackage Structs
 */
class Job_Application_Template_Translation_Request_CriteriaType extends AbstractStructBase
{
    /**
     * The User_Language_Reference
     * Meta information extracted from the WSDL
     * - documentation: Reference ID or WID for translation language
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\User_LanguageObjectType[]
     */
    public $User_Language_Reference;
    /**
     * Constructor method for Job_Application_Template_Translation_Request_CriteriaType
     * @uses Job_Application_Template_Translation_Request_CriteriaType::setUser_Language_Reference()
     * @param \StructType\User_LanguageObjectType[] $user_Language_Reference
     */
    public function __construct(array $user_Language_Reference = array())
    {
        $this
            ->setUser_Language_Reference($user_Language_Reference);
    }
    /**
     * Get User_Language_Reference value
     * @return \StructType\User_LanguageObjectType[]|null
     */
    public function getUser_Language_Reference()
    {
        return $this->User_Language_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setUser_Language_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setUser_Language_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateUser_Language_ReferenceForArrayConstraintsFromSetUser_Language_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $job_Application_Template_Translation_Request_CriteriaTypeUser_Language_ReferenceItem) {
            // validation for constraint: itemType
            if (!$job_Application_Template_Translation_Request_CriteriaTypeUser_Language_ReferenceItem instanceof \StructType\User_LanguageObjectType) {
                $invalidValues[] = is_object($job_Application_Template_Translation_Request_CriteriaTypeUser_Language_ReferenceItem) ? get_class($job_Application_Template_Translation_Request_CriteriaTypeUser_Language_ReferenceItem) : sprintf('%s(%s)', gettype($job_Application_Template_Translation_Request_CriteriaTypeUser_Language_ReferenceItem), var_export($job_Application_Template_Translation_Request_CriteriaTypeUser_Language_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The User_Language_Reference property can only contain items of type \StructType\User_LanguageObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set User_Language_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\User_LanguageObjectType[] $user_Language_Reference
     * @return \StructType\Job_Application_Template_Translation_Request_CriteriaType
     */
    public function setUser_Language_Reference(array $user_Language_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($user_Language_ReferenceArrayErrorMessage = self::validateUser_Language_ReferenceForArrayConstraintsFromSetUser_Language_Reference($user_Language_Reference))) {
            throw new \InvalidArgumentException($user_Language_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->User_Language_Reference = $user_Language_Reference;
        return $this;
    }
    /**
     * Add item to User_Language_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\User_LanguageObjectType $item
     * @return \StructType\Job_Application_Template_Translation_Request_CriteriaType
     */
    public function addToUser_Language_Reference(\StructType\User_LanguageObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\User_LanguageObjectType) {
            throw new \InvalidArgumentException(sprintf('The User_Language_Reference property can only contain items of type \StructType\User_LanguageObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->User_Language_Reference[] = $item;
        return $this;
    }
}
