<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Worktag_Split_Template_Criteria_Response_DataType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: Wrapper Element that includes Worktag Split Template Instance and Data
 * @subpackage Structs
 */
class Worktag_Split_Template_Criteria_Response_DataType extends AbstractStructBase
{
    /**
     * The Worktag_Split_Template_Restriction
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Worktag_Split_Template_CriteriaType[]
     */
    public $Worktag_Split_Template_Restriction;
    /**
     * Constructor method for Worktag_Split_Template_Criteria_Response_DataType
     * @uses Worktag_Split_Template_Criteria_Response_DataType::setWorktag_Split_Template_Restriction()
     * @param \StructType\Worktag_Split_Template_CriteriaType[] $worktag_Split_Template_Restriction
     */
    public function __construct(array $worktag_Split_Template_Restriction = array())
    {
        $this
            ->setWorktag_Split_Template_Restriction($worktag_Split_Template_Restriction);
    }
    /**
     * Get Worktag_Split_Template_Restriction value
     * @return \StructType\Worktag_Split_Template_CriteriaType[]|null
     */
    public function getWorktag_Split_Template_Restriction()
    {
        return $this->Worktag_Split_Template_Restriction;
    }
    /**
     * This method is responsible for validating the values passed to the setWorktag_Split_Template_Restriction method
     * This method is willingly generated in order to preserve the one-line inline validation within the setWorktag_Split_Template_Restriction method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateWorktag_Split_Template_RestrictionForArrayConstraintsFromSetWorktag_Split_Template_Restriction(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $worktag_Split_Template_Criteria_Response_DataTypeWorktag_Split_Template_RestrictionItem) {
            // validation for constraint: itemType
            if (!$worktag_Split_Template_Criteria_Response_DataTypeWorktag_Split_Template_RestrictionItem instanceof \StructType\Worktag_Split_Template_CriteriaType) {
                $invalidValues[] = is_object($worktag_Split_Template_Criteria_Response_DataTypeWorktag_Split_Template_RestrictionItem) ? get_class($worktag_Split_Template_Criteria_Response_DataTypeWorktag_Split_Template_RestrictionItem) : sprintf('%s(%s)', gettype($worktag_Split_Template_Criteria_Response_DataTypeWorktag_Split_Template_RestrictionItem), var_export($worktag_Split_Template_Criteria_Response_DataTypeWorktag_Split_Template_RestrictionItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Worktag_Split_Template_Restriction property can only contain items of type \StructType\Worktag_Split_Template_CriteriaType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Worktag_Split_Template_Restriction value
     * @throws \InvalidArgumentException
     * @param \StructType\Worktag_Split_Template_CriteriaType[] $worktag_Split_Template_Restriction
     * @return \StructType\Worktag_Split_Template_Criteria_Response_DataType
     */
    public function setWorktag_Split_Template_Restriction(array $worktag_Split_Template_Restriction = array())
    {
        // validation for constraint: array
        if ('' !== ($worktag_Split_Template_RestrictionArrayErrorMessage = self::validateWorktag_Split_Template_RestrictionForArrayConstraintsFromSetWorktag_Split_Template_Restriction($worktag_Split_Template_Restriction))) {
            throw new \InvalidArgumentException($worktag_Split_Template_RestrictionArrayErrorMessage, __LINE__);
        }
        $this->Worktag_Split_Template_Restriction = $worktag_Split_Template_Restriction;
        return $this;
    }
    /**
     * Add item to Worktag_Split_Template_Restriction value
     * @throws \InvalidArgumentException
     * @param \StructType\Worktag_Split_Template_CriteriaType $item
     * @return \StructType\Worktag_Split_Template_Criteria_Response_DataType
     */
    public function addToWorktag_Split_Template_Restriction(\StructType\Worktag_Split_Template_CriteriaType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Worktag_Split_Template_CriteriaType) {
            throw new \InvalidArgumentException(sprintf('The Worktag_Split_Template_Restriction property can only contain items of type \StructType\Worktag_Split_Template_CriteriaType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Worktag_Split_Template_Restriction[] = $item;
        return $this;
    }
}
