<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for JP_CruiseComponent StructType
 * @subpackage Structs
 */
class JP_CruiseComponent extends AbstractStructBase
{
    /**
     * The Type
     * Meta informations extracted from the WSDL
     * - use: required
     * @var string
     */
    public $Type;
    /**
     * The Mandatory
     * Meta informations extracted from the WSDL
     * - use: required
     * @var bool
     */
    public $Mandatory;
    /**
     * The Stations
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \ArrayType\ArrayOfJP_CruiseStation
     */
    public $Stations;
    /**
     * The Flights
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \ArrayType\ArrayOfJP_CruiseFlight
     */
    public $Flights;
    /**
     * Constructor method for JP_CruiseComponent
     * @uses JP_CruiseComponent::setType()
     * @uses JP_CruiseComponent::setMandatory()
     * @uses JP_CruiseComponent::setStations()
     * @uses JP_CruiseComponent::setFlights()
     * @param string $type
     * @param bool $mandatory
     * @param \ArrayType\ArrayOfJP_CruiseStation $stations
     * @param \ArrayType\ArrayOfJP_CruiseFlight $flights
     */
    public function __construct($type = null, $mandatory = null, \ArrayType\ArrayOfJP_CruiseStation $stations = null, \ArrayType\ArrayOfJP_CruiseFlight $flights = null)
    {
        $this
            ->setType($type)
            ->setMandatory($mandatory)
            ->setStations($stations)
            ->setFlights($flights);
    }
    /**
     * Get Type value
     * @return string
     */
    public function getType()
    {
        return $this->Type;
    }
    /**
     * Set Type value
     * @uses \EnumType\ComponentsType::valueIsValid()
     * @uses \EnumType\ComponentsType::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $type
     * @return \StructType\JP_CruiseComponent
     */
    public function setType($type = null)
    {
        // validation for constraint: enumeration
        if (!\EnumType\ComponentsType::valueIsValid($type)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $type, implode(', ', \EnumType\ComponentsType::getValidValues())), __LINE__);
        }
        $this->Type = $type;
        return $this;
    }
    /**
     * Get Mandatory value
     * @return bool
     */
    public function getMandatory()
    {
        return $this->Mandatory;
    }
    /**
     * Set Mandatory value
     * @param bool $mandatory
     * @return \StructType\JP_CruiseComponent
     */
    public function setMandatory($mandatory = null)
    {
        // validation for constraint: boolean
        if (!is_null($mandatory) && !is_bool($mandatory)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a bool, "%s" given', gettype($mandatory)), __LINE__);
        }
        $this->Mandatory = $mandatory;
        return $this;
    }
    /**
     * Get Stations value
     * @return \ArrayType\ArrayOfJP_CruiseStation|null
     */
    public function getStations()
    {
        return $this->Stations;
    }
    /**
     * Set Stations value
     * @param \ArrayType\ArrayOfJP_CruiseStation $stations
     * @return \StructType\JP_CruiseComponent
     */
    public function setStations(\ArrayType\ArrayOfJP_CruiseStation $stations = null)
    {
        $this->Stations = $stations;
        return $this;
    }
    /**
     * Get Flights value
     * @return \ArrayType\ArrayOfJP_CruiseFlight|null
     */
    public function getFlights()
    {
        return $this->Flights;
    }
    /**
     * Set Flights value
     * @param \ArrayType\ArrayOfJP_CruiseFlight $flights
     * @return \StructType\JP_CruiseComponent
     */
    public function setFlights(\ArrayType\ArrayOfJP_CruiseFlight $flights = null)
    {
        $this->Flights = $flights;
        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\JP_CruiseComponent
     */
    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__;
    }
}
