import { describe, it, expectTypeOf } from "vitest";
import type {
  EventBusProtocol,
  RealtimeBroadcasterProtocol,
  RealtimeRegistryProtocol,
} from "./bind-protocols";

describe("EventBusProtocol", () => {
  it("requires publish(event, payload) and subscribe(event, consumer, handler)", () => {
    type Bus = EventBusProtocol;
    expectTypeOf<Bus["publish"]>().toBeFunction();
    expectTypeOf<Bus["subscribe"]>().toBeFunction();
  });
});

describe("RealtimeBroadcasterProtocol", () => {
  it("requires broadcast(channel, payload)", () => {
    type Rt = RealtimeBroadcasterProtocol;
    expectTypeOf<Rt["broadcast"]>().toBeFunction();
  });
});

describe("RealtimeRegistryProtocol", () => {
  it("requires register, registerChannel, listChannels", () => {
    type Reg = RealtimeRegistryProtocol;
    expectTypeOf<Reg["register"]>().toBeFunction();
    expectTypeOf<Reg["registerChannel"]>().toBeFunction();
    expectTypeOf<Reg["listChannels"]>().toBeFunction();
  });
});
