import type { PlatformAPI } from "./types";

export function createWebAPI(): PlatformAPI {
    const prefersDark = window.matchMedia?.("(prefers-color-scheme: dark)")?.matches ?? false;

    let backHandler: (() => void) | null = null;

    return {
        platform: "web",
        colorScheme: prefersDark ? "dark" : "light",
        safeAreaInsets: { top: 0, bottom: 0, left: 0, right: 0 },

        haptics: {
            impact: () => {},
            notify: () => {}
        },

        navigation: {
            setBackHandler: (cb) => { backHandler = cb; }
        },

        mainButton: {
            show: () => {},
            hide: () => {},
            setLoading: () => {}
        }
    };
}
