export interface AppserviceConfig {
  /** Homeserver client-server API base, e.g. https://chat.uscllc.com */
  homeserverUrl: string;
  /** Server name used in user IDs, e.g. chat.uscllc.com */
  domain: string;
  /** Token the appservice presents to the homeserver (as_token). */
  asToken: string;
  /** Token the homeserver presents to the appservice (hs_token). */
  hsToken: string;
  /** Localpart prefix owned by this appservice. Default: "agent-". */
  userPrefix?: string;
  /** The appservice's own sender user localpart. Default: "mosaic-as". */
  senderLocalpart?: string;
}

export interface MatrixEvent {
  type: string;
  event_id?: string;
  room_id?: string;
  sender?: string;
  state_key?: string;
  content?: Record<string, unknown>;
  origin_server_ts?: number;
}

export interface Transaction {
  events: MatrixEvent[];
}

export type EventHandler = (event: MatrixEvent) => void | Promise<void>;

export interface HandlerResult {
  status: number;
  body: Record<string, unknown>;
}
