package rasel.lunar.launcher.model

import rasel.lunar.launcher.utils.JamoUtils

class RssTagItem : RssDataInterface {
    var link : String = ""
    var tagTitle = ""
    var count = 0

    override fun title(): String {
        return tagTitle
    }

    override fun thumbnailUrl(): String {
        return ""
    }

    override fun originPage(): String {
        return link
    }

    override fun description(): String {
        return " "
    }

    override fun pubDate(): Long {
        return count.toLong()
    }

    override fun category(): RssDataType {
        return RssDataType.TAGS
    }

    constructor(link: String, tagTitle: String) {
        this.link = link
        this.tagTitle = tagTitle
        if (tagTitle.contains("(") && tagTitle.contains(")")) {
            try {
                count = tagTitle.split("(")[1].split(")")[0].toInt()
            }catch (e : Exception) {}
        }
    }
    override fun getCho(): String? {
        return JamoUtils.split(tagTitle!!).joinToString("")
    }
}