package com.cardshifter.api.outgoing;

import com.cardshifter.api.messages.Message;

public class WelcomeMessage extends Message {

	private static final int STATUS_OK = 200;
	
	private int status;
	private int userId;
	private String message;

	public WelcomeMessage() {
		this(-42, true);
	}
	public WelcomeMessage(int id, boolean success) {
		super("loginresponse");
		this.status = success ? STATUS_OK : 404;
		this.message = success ? "OK" : "Wrong username or password";
		this.userId = id;
	}
	
	public String getMessage() {
		return message;
	}
	
	public int getStatus() {
		return status;
	}
	
	public boolean isOK() {
		return this.status == STATUS_OK;
	}
	
	public int getUserId() {
		return userId;
	}
	
	@Override
	public String toString() {
		return "WelcomeMessage [status=" + status + ", userId=" + userId
				+ ", message=" + message + "]";
	}
	
}

@@ -78,16 +78,60 @@
 ssage;%0A%0A
+/** Response from the server after login */%0A
 public c
@@ -168,16 +168,17 @@
 ssage %7B%0A
+%09
 %0A%09privat
@@ -213,16 +213,61 @@
  = 200;%0A
+%09private static final int STATUS_FAIL = 404;%0A
 %09%0A%09priva
@@ -327,16 +327,50 @@
 essage;%0A
+%09%0A%09/** Constructor. (no params) */
 %0A%09public
@@ -411,16 +411,138 @@
 ue);%0A%09%7D%0A
+%09/**%0A%09 * Constructor.%0A%09 * @param id  The Id of this user%0A%09 * @param success  Whether or not connection is successful%0A%09 */%0A
 %09public 
@@ -647,19 +647,27 @@
 US_OK : 
-404
+STATUS_FAIL
 ;%0A%09%09this
@@ -744,24 +744,52 @@
 d = id;%0A%09%7D%0A%09
+/** @return  This message */
 %0A%09public Str
@@ -825,24 +825,51 @@
 essage;%0A%09%7D%0A%09
+/** @return  This status */
 %0A%09public int
@@ -900,24 +900,79 @@
 status;%0A%09%7D%0A%09
+/** @return  Whether connection status is successful */
 %0A%09public boo
@@ -1024,16 +1024,51 @@
 OK;%0A%09%7D%0A%09
+/** @return  The Id of this user */
 %0A%09public
@@ -1107,16 +1107,68 @@
 Id;%0A%09%7D%0A%09
+/** @return  This message as converted to String  */
 %0A%09@Overr
@@ -1225,16 +1225,24 @@
 essage %5B
+%22%0A%09%09%09+ %22
 status=%22
@@ -1251,16 +1251,20 @@
  status 
+%0A%09%09%09
 + %22, use
@@ -1281,17 +1281,16 @@
 erId%0A%09%09%09
-%09
 + %22, mes
@@ -1306,16 +1306,19 @@
 message 
+%0A%09%09
 + %22%5D%22;%0A%09

Update WelcomeMessage.java