export interface ImapAccount {
	id: string;
	host: string;
	user: string;
	passCmd: string;
	sslType: "IMAPS" | "STARTTLS";
	mailDir: string;
}

export function generateMbsyncConfig(account: ImapAccount): string {
	const { id, host, user, passCmd, sslType, mailDir } = account;
	const trailingSlashDir = mailDir.endsWith("/") ? mailDir : `${mailDir}/`;

	return `IMAPAccount ${id}
Host ${host}
User ${user}
PassCmd "${passCmd}"
SSLType ${sslType}

IMAPStore ${id}-remote
Account ${id}

MaildirStore ${id}-local
Subfolders Verbatim
Path ${trailingSlashDir}
Inbox ${trailingSlashDir}Inbox

Channel ${id}
Far :${id}-remote:
Near :${id}-local:
Patterns *
Create Both
Expunge None
SyncState *
`;
}
