import { assign as xAssign } from "xstate";

import type { ChatEvent } from "./chat-events";
import type { ChatState } from "./chat-state";

export type ChatActionArgs = { context: ChatState; event: ChatEvent };
export type ChatContextArgs = { context: ChatState };

export const chatAssign = (
  assignment: Parameters<
    typeof xAssign<ChatState, ChatEvent, undefined, ChatEvent, never>
  >[0],
) => xAssign<ChatState, ChatEvent, undefined, ChatEvent, never>(assignment);
