<?php
namespace App\AuthenticateFromLidia\Webservice\GetCredentials;

class Response extends \App\AuthenticateFromLidia\Webservice\ResponseAbstract
{
	/**
	 * Stores the username used for auth from LIDIA
	 * @var String
	 */
	protected $username;

	/**
	 * Stores the id user LIDIA who initiate auth from LIDIA
	 * @var String
	 */
	protected $idUserLidia;

	/**
	 * Set the username received from TINA
	 * @param String $username
	 * @return void
	 */
	public function setUsername($username)
	{
		$this->username = $username;
		return $this;
	}

	/**
	 * Set the idUserLidia received from TINA
	 * @param String $username
	 * @return void
	 */
	public function setIdUserLidia($idUserLidia)
	{
		$this->idUserLidia = $idUserLidia;
		return $this;
	}

	/**
	 * Returns username for auth
	 * @return String
	 */
	public function getUsername()
	{
		return $this->username;
	}

	/**
	 * Returns idUserLidia
	 * @return String
	 */
	public function getIdUserLidia()
	{
		return $this->idUserLidia;
	}

	/**
	 * (non-PHPdoc)
	 * @see \App\Lidia\ResponseAbstract::doCheck()
	 */
	protected function doCheck(\App\MessagesCollector $msgs)
	{
		if ($this->status == 'ok' && !$this->username) {
			$msgs->addError(sprintf("The status is `%s`, but username is not set.", $this->status));
		}

		if ($this->status == 'ok' && !$this->idUserLidia) {
			$msgs->addError(sprintf("The status is `%s`, but idUserLidia is not set.", $this->status));
		}
	}
}
