<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Abstract_Request_for_Quote_Bid_RequirementObjectType
 * StructType
 * @subpackage Structs
 */
class Abstract_Request_for_Quote_Bid_RequirementObjectType extends AbstractStructBase
{
    /**
     * The ID
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType[]
     */
    public $ID;
    /**
     * The Descriptor
     * Meta information extracted from the WSDL
     * - documentation: Display information used to describe an instance of an object. This 'optional' information is for outbound descriptive purposes only and is not processed on inbound Workday Web Services requests.
     * @var string
     */
    public $Descriptor;
    /**
     * Constructor method for Abstract_Request_for_Quote_Bid_RequirementObjectType
     * @uses Abstract_Request_for_Quote_Bid_RequirementObjectType::setID()
     * @uses Abstract_Request_for_Quote_Bid_RequirementObjectType::setDescriptor()
     * @param \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType[] $iD
     * @param string $descriptor
     */
    public function __construct(array $iD = array(), $descriptor = null)
    {
        $this
            ->setID($iD)
            ->setDescriptor($descriptor);
    }
    /**
     * Get ID value
     * @return \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType[]|null
     */
    public function getID()
    {
        return $this->ID;
    }
    /**
     * This method is responsible for validating the values passed to the setID method
     * This method is willingly generated in order to preserve the one-line inline validation within the setID method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateIDForArrayConstraintsFromSetID(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $abstract_Request_for_Quote_Bid_RequirementObjectTypeIDItem) {
            // validation for constraint: itemType
            if (!$abstract_Request_for_Quote_Bid_RequirementObjectTypeIDItem instanceof \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType) {
                $invalidValues[] = is_object($abstract_Request_for_Quote_Bid_RequirementObjectTypeIDItem) ? get_class($abstract_Request_for_Quote_Bid_RequirementObjectTypeIDItem) : sprintf('%s(%s)', gettype($abstract_Request_for_Quote_Bid_RequirementObjectTypeIDItem), var_export($abstract_Request_for_Quote_Bid_RequirementObjectTypeIDItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The ID property can only contain items of type \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set ID value
     * @throws \InvalidArgumentException
     * @param \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType[] $iD
     * @return \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectType
     */
    public function setID(array $iD = array())
    {
        // validation for constraint: array
        if ('' !== ($iDArrayErrorMessage = self::validateIDForArrayConstraintsFromSetID($iD))) {
            throw new \InvalidArgumentException($iDArrayErrorMessage, __LINE__);
        }
        $this->ID = $iD;
        return $this;
    }
    /**
     * Add item to ID value
     * @throws \InvalidArgumentException
     * @param \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType $item
     * @return \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectType
     */
    public function addToID(\StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType) {
            throw new \InvalidArgumentException(sprintf('The ID property can only contain items of type \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectIDType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->ID[] = $item;
        return $this;
    }
    /**
     * Get Descriptor value
     * @return string|null
     */
    public function getDescriptor()
    {
        return $this->Descriptor;
    }
    /**
     * Set Descriptor value
     * @param string $descriptor
     * @return \StructType\Abstract_Request_for_Quote_Bid_RequirementObjectType
     */
    public function setDescriptor($descriptor = null)
    {
        // validation for constraint: string
        if (!is_null($descriptor) && !is_string($descriptor)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($descriptor, true), gettype($descriptor)), __LINE__);
        }
        $this->Descriptor = $descriptor;
        return $this;
    }
}
