//#region extensions/telegram/src/adapters/config-adapter.ts
function createTelegramConfigAdapter(options) {
	const { accountManager } = options;
	return {
		listAccountIds: (_cfg) => accountManager.getAllAccounts().map((a) => a.accountId),
		resolveAccount: (_cfg, accountId = "default") => {
			const account = accountManager.getAccount(accountId);
			if (!account) return {
				accountId,
				enabled: false,
				botToken: ""
			};
			return {
				accountId: account.accountId,
				name: account.name,
				enabled: account.enabled !== false,
				botToken: account.botToken || "",
				apiRoot: account.apiRoot,
				dmPolicy: account.dmPolicy,
				groupPolicy: account.groupPolicy,
				allowFrom: account.allowFrom,
				groupAllowFrom: account.groupAllowFrom,
				requireMention: account.requireMention,
				streamMode: account.streamMode
			};
		},
		isEnabled: (account) => account.enabled !== false,
		disabledReason: (account) => {
			if (account.enabled === false) return "Account disabled";
			if (!account.botToken) return "No token configured";
			return "";
		},
		isConfigured: async (account) => !!account.botToken,
		describeAccount: (account) => {
			const status = accountManager.getStatus(account.accountId);
			return {
				accountId: account.accountId,
				channelId: "telegram",
				enabled: account.enabled !== false,
				configured: !!account.botToken,
				status: status?.running ? "running" : "stopped"
			};
		}
	};
}
//#endregion
export { createTelegramConfigAdapter };

//# sourceMappingURL=config-adapter.js.map