package com.tencent.liteav.demo.superplayer.database.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.TODO

@Entity
data class History(
    @PrimaryKey(autoGenerate = true)
    var id: Long? = null,

    @ColumnInfo(name = "start")
    val start: Long,

    @ColumnInfo(name = "end")
    val end: Long,

    @ColumnInfo(name = "course_id")
    val courseId: String,

    @ColumnInfo(name = "section_id")
    val sectionId: String,

    @ColumnInfo(name = "date")
    val date: String,

    @ColumnInfo(name = "ct_id")
    val countDown: String? = null,
) : Comparator<History>, Comparable<History> {
    override fun compare(o1: History, o2: History): Int {
        if (o1.start < o2.start) return -1
        if (o1.start > o2.start) return 1

        if (o1.end < o2.end) return 1;
        if (o1.end > o2.end) return -1

        return 0;
    }

    override fun compareTo(other: History): Int {
        if (this.start < other.start) return -1
        if (this.start > other.start) return 1

        if (this.end < other.end) return 1;
        if (this.end > other.end) return -1

        return 0;
    }

}