package de.sebse.fuplanner2.database

import com.beust.klaxon.Klaxon
import com.beust.klaxon.KlaxonException


data class Lecturer (
    val firstName: String,
    val lastName: String,
    val email: String,
    val isResponsible: Boolean
) {
    fun toJsonString(): String {
        return Klaxon().toJsonString(this)
    }

    companion object {
        fun fromString(json: String): Lecturer? {
            return try {
                Klaxon().parse<Lecturer>(json)
            } catch (e: KlaxonException) {
                null
            }
        }
    }
}
