import * as Misskey from "calckey-js";

export type swMessageOrderType = "post" | "push";

export type SwMessage = {
	type: "order";
	order: swMessageOrderType;
	loginId: string;
	url: string;
	[x: string]: any;
};

// Defined also @/services/push-notification.ts#L7-L14
type pushNotificationDataSourceMap = {
	notification: Misskey.entities.Notification;
	readNotifications: { notificationIds: string[] };
	readAllNotifications: undefined;
};

export type pushNotificationData<
	K extends keyof pushNotificationDataSourceMap,
> = {
	type: K;
	body: pushNotificationDataSourceMap[K];
	userId: string;
	dateTime: number;
};

export type pushNotificationDataMap = {
	[K in keyof pushNotificationDataSourceMap]: pushNotificationData<K>;
};
