import { io } from "@/server";
import { wsRooms } from "./ws.rooms";
import { ShopWsEvent } from "ttm-shared";
import type { ShopEventWire, WsEventType, WsEventPayload } from "ttm-shared";

export function wsEmitShopEvent<T extends WsEventType>(
    shopId: string,
    evt: ShopEventWire<T>
) {
    io.to(wsRooms.shop(shopId)).emit(ShopWsEvent.EVENT, evt);
}