<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for OTA_VehRateRuleRSFees StructType
 * @package Dg
 * @subpackage Structs
 */
class DgOTA_VehRateRuleRSFees extends AbstractStructBase
{
    /**
     * The Fee
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgVehicleChargePurposeType[]
     */
    public $Fee;
    /**
     * Constructor method for OTA_VehRateRuleRSFees
     * @uses DgOTA_VehRateRuleRSFees::setFee()
     * @param \dgsoft\StructType\DgVehicleChargePurposeType[] $fee
     */
    public function __construct(array $fee = array())
    {
        $this
            ->setFee($fee);
    }
    /**
     * Get Fee value
     * @return \dgsoft\StructType\DgVehicleChargePurposeType[]|null
     */
    public function getFee()
    {
        return $this->Fee;
    }
    /**
     * Set Fee value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgVehicleChargePurposeType[] $fee
     * @return \dgsoft\StructType\DgOTA_VehRateRuleRSFees
     */
    public function setFee(array $fee = array())
    {
        foreach ($fee as $oTA_VehRateRuleRSFeesFeeItem) {
            // validation for constraint: itemType
            if (!$oTA_VehRateRuleRSFeesFeeItem instanceof \dgsoft\StructType\DgVehicleChargePurposeType) {
                throw new \InvalidArgumentException(sprintf('The Fee property can only contain items of \dgsoft\StructType\DgVehicleChargePurposeType, "%s" given', is_object($oTA_VehRateRuleRSFeesFeeItem) ? get_class($oTA_VehRateRuleRSFeesFeeItem) : gettype($oTA_VehRateRuleRSFeesFeeItem)), __LINE__);
            }
        }
        $this->Fee = $fee;
        return $this;
    }
    /**
     * Add item to Fee value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgVehicleChargePurposeType $item
     * @return \dgsoft\StructType\DgOTA_VehRateRuleRSFees
     */
    public function addToFee(\dgsoft\StructType\DgVehicleChargePurposeType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgVehicleChargePurposeType) {
            throw new \InvalidArgumentException(sprintf('The Fee property can only contain items of \dgsoft\StructType\DgVehicleChargePurposeType, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->Fee[] = $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_VehRateRuleRSFees
     */
    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__;
    }
}
