<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for JP_MeetingPointsZone StructType
 * @subpackage Structs
 */
class JP_MeetingPointsZone extends AbstractStructBase
{
    /**
     * The MeetingPoint
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\JP_MeetingPoint[]
     */
    public $MeetingPoint;
    /**
     * The MeetingHotelPoint
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\JP_MeetingHotelPoint[]
     */
    public $MeetingHotelPoint;
    /**
     * The Name
     * @var string
     */
    public $Name;
    /**
     * Constructor method for JP_MeetingPointsZone
     * @uses JP_MeetingPointsZone::setMeetingPoint()
     * @uses JP_MeetingPointsZone::setMeetingHotelPoint()
     * @uses JP_MeetingPointsZone::setName()
     * @param \StructType\JP_MeetingPoint[] $meetingPoint
     * @param \StructType\JP_MeetingHotelPoint[] $meetingHotelPoint
     * @param string $name
     */
    public function __construct(array $meetingPoint = array(), array $meetingHotelPoint = array(), $name = null)
    {
        $this
            ->setMeetingPoint($meetingPoint)
            ->setMeetingHotelPoint($meetingHotelPoint)
            ->setName($name);
    }
    /**
     * Get MeetingPoint value
     * @return \StructType\JP_MeetingPoint[]|null
     */
    public function getMeetingPoint()
    {
        return $this->MeetingPoint;
    }
    /**
     * This method is responsible for validating the values passed to the setMeetingPoint method
     * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingPoint method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateMeetingPointForArrayConstraintsFromSetMeetingPoint(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $jP_MeetingPointsZoneMeetingPointItem) {
            // validation for constraint: itemType
            if (!$jP_MeetingPointsZoneMeetingPointItem instanceof \StructType\JP_MeetingPoint) {
                $invalidValues[] = is_object($jP_MeetingPointsZoneMeetingPointItem) ? get_class($jP_MeetingPointsZoneMeetingPointItem) : sprintf('%s(%s)', gettype($jP_MeetingPointsZoneMeetingPointItem), var_export($jP_MeetingPointsZoneMeetingPointItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The MeetingPoint property can only contain items of type \StructType\JP_MeetingPoint, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set MeetingPoint value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_MeetingPoint[] $meetingPoint
     * @return \StructType\JP_MeetingPointsZone
     */
    public function setMeetingPoint(array $meetingPoint = array())
    {
        // validation for constraint: array
        if ('' !== ($meetingPointArrayErrorMessage = self::validateMeetingPointForArrayConstraintsFromSetMeetingPoint($meetingPoint))) {
            throw new \InvalidArgumentException($meetingPointArrayErrorMessage, __LINE__);
        }
        $this->MeetingPoint = $meetingPoint;
        return $this;
    }
    /**
     * Add item to MeetingPoint value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_MeetingPoint $item
     * @return \StructType\JP_MeetingPointsZone
     */
    public function addToMeetingPoint(\StructType\JP_MeetingPoint $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\JP_MeetingPoint) {
            throw new \InvalidArgumentException(sprintf('The MeetingPoint property can only contain items of type \StructType\JP_MeetingPoint, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->MeetingPoint[] = $item;
        return $this;
    }
    /**
     * Get MeetingHotelPoint value
     * @return \StructType\JP_MeetingHotelPoint[]|null
     */
    public function getMeetingHotelPoint()
    {
        return $this->MeetingHotelPoint;
    }
    /**
     * This method is responsible for validating the values passed to the setMeetingHotelPoint method
     * This method is willingly generated in order to preserve the one-line inline validation within the setMeetingHotelPoint method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateMeetingHotelPointForArrayConstraintsFromSetMeetingHotelPoint(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $jP_MeetingPointsZoneMeetingHotelPointItem) {
            // validation for constraint: itemType
            if (!$jP_MeetingPointsZoneMeetingHotelPointItem instanceof \StructType\JP_MeetingHotelPoint) {
                $invalidValues[] = is_object($jP_MeetingPointsZoneMeetingHotelPointItem) ? get_class($jP_MeetingPointsZoneMeetingHotelPointItem) : sprintf('%s(%s)', gettype($jP_MeetingPointsZoneMeetingHotelPointItem), var_export($jP_MeetingPointsZoneMeetingHotelPointItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The MeetingHotelPoint property can only contain items of type \StructType\JP_MeetingHotelPoint, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set MeetingHotelPoint value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_MeetingHotelPoint[] $meetingHotelPoint
     * @return \StructType\JP_MeetingPointsZone
     */
    public function setMeetingHotelPoint(array $meetingHotelPoint = array())
    {
        // validation for constraint: array
        if ('' !== ($meetingHotelPointArrayErrorMessage = self::validateMeetingHotelPointForArrayConstraintsFromSetMeetingHotelPoint($meetingHotelPoint))) {
            throw new \InvalidArgumentException($meetingHotelPointArrayErrorMessage, __LINE__);
        }
        $this->MeetingHotelPoint = $meetingHotelPoint;
        return $this;
    }
    /**
     * Add item to MeetingHotelPoint value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_MeetingHotelPoint $item
     * @return \StructType\JP_MeetingPointsZone
     */
    public function addToMeetingHotelPoint(\StructType\JP_MeetingHotelPoint $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\JP_MeetingHotelPoint) {
            throw new \InvalidArgumentException(sprintf('The MeetingHotelPoint property can only contain items of type \StructType\JP_MeetingHotelPoint, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->MeetingHotelPoint[] = $item;
        return $this;
    }
    /**
     * Get Name value
     * @return string|null
     */
    public function getName()
    {
        return $this->Name;
    }
    /**
     * Set Name value
     * @param string $name
     * @return \StructType\JP_MeetingPointsZone
     */
    public function setName($name = null)
    {
        // validation for constraint: string
        if (!is_null($name) && !is_string($name)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($name, true), gettype($name)), __LINE__);
        }
        $this->Name = $name;
        return $this;
    }
}
