package model;

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

import controller.DataBase;

public class MessageAffichage {
	
	private String message;
	private int idSrc;
	private int idDest;
	private Date date;
	
	public MessageAffichage(String message, int idSrc, int idDest) {
		this.idDest=idDest;
		this.message = message;
		this.idSrc = idSrc;
		this.setDate(DataBase.getInstance().getDateFromMessage(this.idSrc, this.idDest, this.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;
	}

	public int getId() {
		return idSrc;
	}

	public void setId(int id) {
		this.idSrc = id;
	}
	
}
