import {
  doModifyAutoEssay as dbModifyAutoEssay,
  getAutoEssays as dbGetAutoEssays,
  postAutoEssay as dbPostAutoEssay,
  wipeAutoEssay as dbWipeAutoEssay,
} from "@/app/www/system/DB";
import { getDatetime } from "taehui-lib/date";

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

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

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

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