package org.wcs.model.pojo.serve;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * 发送到前端通知的信息
 */
@Setter
@Getter
public class NotificationInfo {

    /**
     * 消息
     */
    @JsonProperty("message")
    private String message;

    /**
     * 标题
     */
    @JsonProperty("title")
    private String title;

    /**
     * 类型
     */
    @JsonProperty("type")
    private String type;

    /**
     * 持续时间
     */
    @JsonProperty("duration")
    private Integer duration;


    public static NotificationInfo success(String message, String title, Integer duration) {
        NotificationInfo info = new NotificationInfo();
        info.setMessage(message);
        info.setTitle(title);
        info.setType("success");
        info.setDuration(duration);
        return info;
    }

    public static NotificationInfo error(String message, String title, Integer duration) {
        NotificationInfo info = new NotificationInfo();
        info.setMessage(message);
        info.setTitle(title);
        info.setType("error");
        info.setDuration(duration);
        return info;
    }

    public static NotificationInfo warning(String message, String title, Integer duration) {
        NotificationInfo info = new NotificationInfo();
        info.setMessage(message);
        info.setTitle(title);
        info.setType("warning");
        info.setDuration(duration);
        return info;
    }

    public static NotificationInfo info(String message, String title, Integer duration) {
        NotificationInfo info = new NotificationInfo();
        info.setMessage(message);
        info.setTitle(title);
        info.setType("info");
        info.setDuration(duration);
        return info;
    }


}
