import kotlin.Int;
import kotlin.String;
import kotlin.collections.List;

CREATE TABLE IF NOT EXISTS SavedPost(
  shortId TEXT NOT NULL PRIMARY KEY,
  title TEXT NOT NULL,
  url TEXT NOT NULL,
  createdAt TEXT NOT NULL,
  commentCount INTEGER AS Int,
  commentsUrl TEXT NOT NULL,
  submitterName TEXT NOT NULL,
  submitterAvatarUrl TEXT NOT NULL,
  tags TEXT AS List<String> NOT NULL
);

insertOrReplacePost:
INSERT OR REPLACE
INTO SavedPost
VALUES ?;

selectAllPosts:
SELECT *
FROM SavedPost;

selectCount:
SELECT COUNT(*)
FROM SavedPost;

deleteAllPosts:
DELETE
FROM SavedPost;

deletePost:
DELETE
FROM SavedPost
WHERE shortId = ?;

selectPost:
SELECT *
FROM SavedPost
WHERE shortId = ?;
