package net.pterodactylus.sone.data
+import net.pterodactylus.sone.database.PostReplyBuilder
import java.util.Comparator.comparing
/**
@get:JvmName("newestReplyFirst")
val newestReplyFirst: Comparator<Reply<*>> =
comparing(Reply<*>::getTime).reversed()
+
+/**
+ * Predicate that returns whether a reply is _not_ from the future,
+ * i.e. whether it should be visible now.
+ */
+val noFutureReply: (Reply<*>) -> Boolean =
+ { it.getTime() <= System.currentTimeMillis() }
+
+data class PostReplyShell(val id: String, val soneId: String, val postId: String, val time: Long, val text: String) {
+
+ fun build(postReplyBuilder: PostReplyBuilder): PostReply {
+ return postReplyBuilder.withId(id).from(soneId).to(postId).withTime(time).withText(text).build()
+ }
+
+}
+
+fun PostReply.toShell() = PostReplyShell(id, sone.id, postId, time, text)