<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for JPSOAP_HotelRatePlanRestriction StructType
 * @subpackage Structs
 */
class JPSOAP_HotelRatePlanRestriction extends JPSOAP_BaseSupleOfferRest
{
    /**
     * The Type
     * Meta informations extracted from the WSDL
     * - use: required
     * @var string
     */
    public $Type;
    /**
     * The Packaged
     * Meta informations extracted from the WSDL
     * - use: required
     * @var bool
     */
    public $Packaged;
    /**
     * The ApplicationRules
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \StructType\JPSOAP_ApplicationRules
     */
    public $ApplicationRules;
    /**
     * Constructor method for JPSOAP_HotelRatePlanRestriction
     * @uses JPSOAP_HotelRatePlanRestriction::setType()
     * @uses JPSOAP_HotelRatePlanRestriction::setPackaged()
     * @uses JPSOAP_HotelRatePlanRestriction::setApplicationRules()
     * @param string $type
     * @param bool $packaged
     * @param \StructType\JPSOAP_ApplicationRules $applicationRules
     */
    public function __construct($type = null, $packaged = null, \StructType\JPSOAP_ApplicationRules $applicationRules = null)
    {
        $this
            ->setType($type)
            ->setPackaged($packaged)
            ->setApplicationRules($applicationRules);
    }
    /**
     * Get Type value
     * @return string
     */
    public function getType()
    {
        return $this->Type;
    }
    /**
     * Set Type value
     * @uses \EnumType\JPSOAP_RestrictionType::valueIsValid()
     * @uses \EnumType\JPSOAP_RestrictionType::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $type
     * @return \StructType\JPSOAP_HotelRatePlanRestriction
     */
    public function setType($type = null)
    {
        // validation for constraint: enumeration
        if (!\EnumType\JPSOAP_RestrictionType::valueIsValid($type)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $type, implode(', ', \EnumType\JPSOAP_RestrictionType::getValidValues())), __LINE__);
        }
        $this->Type = $type;
        return $this;
    }
    /**
     * Get Packaged value
     * @return bool
     */
    public function getPackaged()
    {
        return $this->Packaged;
    }
    /**
     * Set Packaged value
     * @param bool $packaged
     * @return \StructType\JPSOAP_HotelRatePlanRestriction
     */
    public function setPackaged($packaged = null)
    {
        // validation for constraint: boolean
        if (!is_null($packaged) && !is_bool($packaged)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a bool, "%s" given', gettype($packaged)), __LINE__);
        }
        $this->Packaged = $packaged;
        return $this;
    }
    /**
     * Get ApplicationRules value
     * @return \StructType\JPSOAP_ApplicationRules|null
     */
    public function getApplicationRules()
    {
        return $this->ApplicationRules;
    }
    /**
     * Set ApplicationRules value
     * @param \StructType\JPSOAP_ApplicationRules $applicationRules
     * @return \StructType\JPSOAP_HotelRatePlanRestriction
     */
    public function setApplicationRules(\StructType\JPSOAP_ApplicationRules $applicationRules = null)
    {
        $this->ApplicationRules = $applicationRules;
        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 \StructType\JPSOAP_HotelRatePlanRestriction
     */
    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__;
    }
}
