package it.danieleverducci.openweddingapp.entities

import org.json.JSONException
import org.json.JSONObject

class NtfyMessage {
    /**
     * Represents a Ntfy (see https://ntfy.sh/docs) message
     *
     * {
     * "id": "8FKvDaOZbBPQ",
     * "time": 1662446843,
     * "event": "message",
     * "topic": "topic_name_257y3h53",
     * "message": "Lorem ipsum dolor sit amet",
     * "priority": 3
     * }
     */

    var id: String
    var time: Long
    var event: String
    var topic: String
    var message: String
    var priority: Int

    @Throws(JSONException::class)
    constructor(jo: JSONObject) {
        this.id = jo.getString("id")
        this.time = jo.getLong("time")
        this.event = jo.getString("event")
        this.topic = jo.getString("topic")
        this.message = jo.getString("message")
        this.priority = jo.getInt("priority")
    }
}