package model;

import java.net.InetAddress;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MessageChat extends Message{

	private static final long serialVersionUID = 1L;
	
	private String message;
	private Date date;
	
	public MessageChat(InetAddress addressSrc, InetAddress addressDest, int portSrc, int portDest, int typeMessage, String message) {
		super(addressSrc, addressDest, portSrc, portDest, typeMessage);
		this.setDate(new Date());
		this.message = message;
	}
	
	public String dateToString() {
        DateFormat format = new SimpleDateFormat("(yyyy/MM/dd HH:mm:ss)");
        return format.format(this.getDate());
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date d) {
        this.date = d;
    }

	public String getMessage() {
		return message+" "+dateToString();
	}
	

	public void setMessage(String message) {
		this.message = message;
	}
	
}
