package net.cobem.grizzly.communication.events.moderation;

import net.cobem.grizzly.Grizzly;
import net.cobem.grizzly.communication.EventRequest;
import net.cobem.grizzly.communication.EventResponse;
import net.cobem.grizzly.communication.GameEvent;
import net.cobem.grizzly.communication.HeaderLibrary;
import net.cobem.grizzly.habbohotel.sessions.Session;
import net.cobem.grizzly.habbohotel.users.User;
import net.cobem.grizzly.habbohotel.users.UserDAO;

public class ShowUserInformationEvent implements GameEvent {
    @Override
    public void compose(Session Session, EventRequest Request) {
        EventResponse Message = new EventResponse();

        int UserID = Request.readInt();

        User mUser;
        boolean Online = false;

        if (Grizzly.getHabboHotel().getSessions().getByID(UserID) == null) {
            mUser = UserDAO.generateUser(UserID);
        } else {
            mUser = Grizzly.getHabboHotel().getSessions().getByID(UserID).getHabbo();
            Online = true;
        }

        Message.Initialize(HeaderLibrary.SendModToolsUserInformationEvent);

        Message.addInt(mUser.getID());
        Message.addString(mUser.getUsername());
        Message.addInt(0); //Minutes online overall
        Message.addInt(0); //Minutes online today
        Message.addBool(Online);
        Message.addInt(0); //CFHs overall
        Message.addInt(0); //Abusive CFH overall
        Message.addInt(0); //Cautions
        Message.addInt(0); //Bans

        Session.sendResponse(Message);
    }
}
