<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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