<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for JP_EmergencyContact StructType
 * @subpackage Structs
 */
class JP_EmergencyContact extends AbstractStructBase
{
    /**
     * The Name
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string
     */
    public $Name;
    /**
     * The PhoneNumbers
     * Meta informations extracted from the WSDL
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var \ArrayType\ArrayOfJP_PhoneNumber
     */
    public $PhoneNumbers;
    /**
     * The Allowed
     * @var bool
     */
    public $Allowed;
    /**
     * Constructor method for JP_EmergencyContact
     * @uses JP_EmergencyContact::setName()
     * @uses JP_EmergencyContact::setPhoneNumbers()
     * @uses JP_EmergencyContact::setAllowed()
     * @param string $name
     * @param \ArrayType\ArrayOfJP_PhoneNumber $phoneNumbers
     * @param bool $allowed
     */
    public function __construct($name = null, \ArrayType\ArrayOfJP_PhoneNumber $phoneNumbers = null, $allowed = null)
    {
        $this
            ->setName($name)
            ->setPhoneNumbers($phoneNumbers)
            ->setAllowed($allowed);
    }
    /**
     * Get Name value
     * @return string|null
     */
    public function getName()
    {
        return $this->Name;
    }
    /**
     * Set Name value
     * @param string $name
     * @return \StructType\JP_EmergencyContact
     */
    public function setName($name = null)
    {
        // validation for constraint: string
        if (!is_null($name) && !is_string($name)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($name)), __LINE__);
        }
        $this->Name = $name;
        return $this;
    }
    /**
     * Get PhoneNumbers value
     * @return \ArrayType\ArrayOfJP_PhoneNumber|null
     */
    public function getPhoneNumbers()
    {
        return $this->PhoneNumbers;
    }
    /**
     * Set PhoneNumbers value
     * @param \ArrayType\ArrayOfJP_PhoneNumber $phoneNumbers
     * @return \StructType\JP_EmergencyContact
     */
    public function setPhoneNumbers(\ArrayType\ArrayOfJP_PhoneNumber $phoneNumbers = null)
    {
        $this->PhoneNumbers = $phoneNumbers;
        return $this;
    }
    /**
     * Get Allowed value
     * @return bool|null
     */
    public function getAllowed()
    {
        return $this->Allowed;
    }
    /**
     * Set Allowed value
     * @param bool $allowed
     * @return \StructType\JP_EmergencyContact
     */
    public function setAllowed($allowed = null)
    {
        // validation for constraint: boolean
        if (!is_null($allowed) && !is_bool($allowed)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a bool, "%s" given', gettype($allowed)), __LINE__);
        }
        $this->Allowed = $allowed;
        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_EmergencyContact
     */
    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__;
    }
}
