/* eslint react-native/split-platform-components: off */

import { Platform, PlatformIOSStatic, NativeModules } from "react-native";
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
import { F as alwaysFalse } from "ramda";
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";

const useIsTabletIos = (): boolean => {
  const { isPad } = Platform as PlatformIOSStatic;

  return isPad;
};

const useIsTabletAndroid = (): boolean => {
  const { initialProps } = NativeModules.QuickBrickCommunicationModule;

  return toBooleanWithDefaultFalse(initialProps?.is_tablet);
};

export const useIsTablet = platformSelect({
  ios: useIsTabletIos,
  android: useIsTabletAndroid,
  lg_tv: alwaysFalse,
  samsung_tv: alwaysFalse,
  android_tv: alwaysFalse,
  tvos: alwaysFalse,
  default: alwaysFalse,
});
