import type { Accessor } from "solid-js";
import type { PageLifecycle } from "../sdk/lifecycle";
import type { HostSharedState, PageCommand } from "../sdk/protocol";

export type PageProps = {
  state: Accessor<HostSharedState | null>;
  /**
   * False while a keep-alive iframe is hidden. Page-owned polling, media or
   * render loops should pause until this accessor becomes true again.
   */
  active: Accessor<boolean>;
  /**
   * Transition events for imperative Page work.
   *
   * Use `onShow` to refresh stale data, `onHide` to pause background work, and
   * `onUnload` for final cleanup. Subscriptions return an unsubscribe function.
   */
  lifecycle: PageLifecycle;
  command: (command: PageCommand) => void;
};
