import san from "sanitize-html";
import { FormChapter } from "~/lib/client/types/form/story";
import { countWords } from "~/lib/functions";
import { IChapter } from "~/models/stories/chapter";
import { sanitizeConf } from "../constants";
import bodyHandler from "./bodyHandler";

export default function (c: FormChapter): IChapter {
	let t: IChapter = {
		title: c.chapterTitle,
		summary: san(c.summary, sanitizeConf),
		notes: san(c.notes, sanitizeConf),
		bands: c.bands,
		characters: c.characters,
		relationships: c.relationships,
		nsfw: c.nsfw,
		genre: c.genre,
		loggedInOnly: c.loggedInOnly,
		hidden: c.hidden,
	};
	return t;
}
