package com.jachdev.consumerprotection.data;

import com.jachdev.consumerprotection.data.enums.MessageType;

import androidx.annotation.NonNull;

/**
 * Created by Charitha Ratnayake(charitha.r@eyepax.com) on 4/23/2022.
 */
public class BotMessage extends BotRequest{

    private String uid;
    private String message;
    private MessageType messageType;
    private long timestamp;

    public BotMessage(String uid, String message) {
        this.uid = uid;
        this.message = message;
    }

    public BotMessage() {

    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getMessage() {
        return message;
    }

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

    public MessageType getMessageType() {
        return messageType;
    }

    public void setMessageType(MessageType messageType) {
        this.messageType = messageType;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    @Override
    public String toString() {
        return "BotMessage{" +
                "uid='" + uid + '\'' +
                ", message='" + message + '\'' +
                ", messageType=" + messageType +
                ", timestamp=" + timestamp +
                '}';
    }

    public void setBotResponse(BotResponse response) {
        if(response == null)return;

        uid = "0";
        message = response.getCnt();
        timestamp = System.currentTimeMillis()/1000L;
        messageType = MessageType.RECEIVER;
    }

    public void setSenderResponse() {

        timestamp = System.currentTimeMillis()/1000L;
        messageType = MessageType.SENDER;
    }
}
