<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for OTA_VehRateRuleRSRateRulesPaymentRules StructType
 * @package Dg
 * @subpackage Structs
 */
class DgOTA_VehRateRuleRSRateRulesPaymentRules extends DgPaymentRulesType
{
    /**
     * The AcceptablePayments
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments[]
     */
    public $AcceptablePayments;
    /**
     * Constructor method for OTA_VehRateRuleRSRateRulesPaymentRules
     * @uses DgOTA_VehRateRuleRSRateRulesPaymentRules::setAcceptablePayments()
     * @param \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments[] $acceptablePayments
     */
    public function __construct(array $acceptablePayments = array())
    {
        $this
            ->setAcceptablePayments($acceptablePayments);
    }
    /**
     * Get AcceptablePayments value
     * @return \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments[]|null
     */
    public function getAcceptablePayments()
    {
        return $this->AcceptablePayments;
    }
    /**
     * Set AcceptablePayments value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments[] $acceptablePayments
     * @return \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRules
     */
    public function setAcceptablePayments(array $acceptablePayments = array())
    {
        foreach ($acceptablePayments as $oTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePaymentsItem) {
            // validation for constraint: itemType
            if (!$oTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePaymentsItem instanceof \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments) {
                throw new \InvalidArgumentException(sprintf('The AcceptablePayments property can only contain items of \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments, "%s" given', is_object($oTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePaymentsItem) ? get_class($oTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePaymentsItem) : gettype($oTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePaymentsItem)), __LINE__);
            }
        }
        $this->AcceptablePayments = $acceptablePayments;
        return $this;
    }
    /**
     * Add item to AcceptablePayments value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments $item
     * @return \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRules
     */
    public function addToAcceptablePayments(\dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments) {
            throw new \InvalidArgumentException(sprintf('The AcceptablePayments property can only contain items of \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRulesAcceptablePayments, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->AcceptablePayments[] = $item;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return \dgsoft\StructType\DgOTA_VehRateRuleRSRateRulesPaymentRules
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
