<?php

namespace Parameters;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for UserLoginMinimalData Parameters
 * Meta information extracted from the WSDL
 * - nillable: true
 * - type: tns:UserLoginMinimalData
 * @subpackage Structs
 */
class UserLoginMinimalData extends AbstractStructBase
{
    /**
     * The ContactPersonData
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var \Parameters\ContactPersonData
     */
    public $ContactPersonData;
    /**
     * The Username
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var string
     */
    public $Username;
    /**
     * Constructor method for UserLoginMinimalData
     * @uses UserLoginMinimalData::setContactPersonData()
     * @uses UserLoginMinimalData::setUsername()
     * @param \Parameters\ContactPersonData $contactPersonData
     * @param string $username
     */
    public function __construct(\Parameters\ContactPersonData $contactPersonData = null, $username = null)
    {
        $this
            ->setContactPersonData($contactPersonData)
            ->setUsername($username);
    }
    /**
     * Get ContactPersonData value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return \Parameters\ContactPersonData|null
     */
    public function getContactPersonData()
    {
        return isset($this->ContactPersonData) ? $this->ContactPersonData : null;
    }
    /**
     * Set ContactPersonData value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @param \Parameters\ContactPersonData $contactPersonData
     * @return \Parameters\UserLoginMinimalData
     */
    public function setContactPersonData(\Parameters\ContactPersonData $contactPersonData = null)
    {
        if (is_null($contactPersonData) || (is_array($contactPersonData) && empty($contactPersonData))) {
            unset($this->ContactPersonData);
        } else {
            $this->ContactPersonData = $contactPersonData;
        }
        return $this;
    }
    /**
     * Get Username value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return string|null
     */
    public function getUsername()
    {
        return isset($this->Username) ? $this->Username : null;
    }
    /**
     * Set Username value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @param string $username
     * @return \Parameters\UserLoginMinimalData
     */
    public function setUsername($username = null)
    {
        // validation for constraint: string
        if (!is_null($username) && !is_string($username)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($username, true), gettype($username)), __LINE__);
        }
        if (is_null($username) || (is_array($username) && empty($username))) {
            unset($this->Username);
        } else {
            $this->Username = $username;
        }
        return $this;
    }
}
