package app.furmeet.events.system.schedule.abstractDataTypes.convention

import app.furmeet.events.system.helper.Language
import java.io.Serializable
import java.util.*

class Announcement(
        val uuid: String,
        val title: Map<Language, String>,
        val body: Map<Language, String>,
        val link: Map<Language, String>?,
        val created: GregorianCalendar,
        val modified: GregorianCalendar
) : Serializable {
    override fun equals(other: Any?): Boolean {
        return when (other) {
            null -> false
            is Announcement -> this.uuid == other.uuid &&
                    this.title == other.title &&
                    this.body == other.body &&
                    this.link == other.link &&
                    this.created == other.created &&
                    this.modified == other.modified
            else -> super.equals(other)
        }
    }

    override fun hashCode(): Int {
        var result = uuid.hashCode()
        result = 31 * result + title.hashCode()
        result = 31 * result + body.hashCode()
        result = 31 * result + (link?.hashCode() ?: 0)
        result = 31 * result + created.hashCode()
        result = 31 * result + modified.hashCode()
        return result
    }
}
