import { getDatetime } from "taehui-ts/date";

import DB from "src/system/DB";

export const postAutoEssay = async (
  forumID: string,
  avatarID: string,
  title: string,
  text: string,
) => {
  return DB.postAutoEssay(forumID, avatarID, title, text, getDatetime());
};

export const getAutoEssays = async (forumID: string, avatarID: string) => {
  return DB.getAutoEssays(forumID, avatarID);
};

export const doModifyAutoEssay = async (
  autoEssayID: number,
  avatarID: string,
  title: string,
  text: string,
) => {
  return DB.doModifyAutoEssay(
    autoEssayID,
    avatarID,
    title,
    text,
    getDatetime(),
  );
};

export const wipeAutoEssay = async (autoEssayID: number, avatarID: string) => {
  return DB.wipeAutoEssay(autoEssayID, avatarID);
};
