export default function setForumStore() {
  return {
    title: "",
    text: "",
    autoEssayID: undefined as number | undefined,
    isAutoEssayOpened: false,

    lastPage: 0,
    pageUnit: 10,
    viewUnit: 10,
    level: 0,

    setTitle(title: string) {
      this.title = title;
    },

    setText(text: string) {
      this.text = text;
    },

    setAutoEssayID(autoEssayID?: number) {
      this.autoEssayID = autoEssayID;
    },

    setAutoEssayOpened(isAutoEssayOpened: boolean) {
      this.isAutoEssayOpened = isAutoEssayOpened;
    },

    setLastPage(lastPage: number) {
      this.lastPage = lastPage;
    },

    setLevel(level: number) {
      this.level = level;
    },

    get isTitleTextFilled() {
      return this.title && this.text;
    },
  };
}
