import { Platform } from 'react-native'
import { Swift as UnsupportedSwift } from './unsupported'
import {
  Button,
  ControlGroup,
  DisclosureGroup,
  Divider,
  Form,
  Glass,
  GlassEffectContainer,
  GeometryReader,
  Group,
  GroupBox,
  ViewThatFits,
  HStack,
  Host,
  LabeledContent,
  LazyHStack,
  LazyVStack,
  LazyHGrid,
  LazyVGrid,
  Grid,
  GridRow,
  Link,
  List,
  Overlay,
  ViewSlot,
  ScrollView,
  ScrollViewReader,
  Section,
  Slot,
  Spacer,
  SwipeActions,
  VStack,
  ZStack,
} from './Containers.native'
import { ContextMenu as AndroidContextMenu, Menu as AndroidMenu } from './AndroidMenu'
import { ContextMenu as IOSContextMenu, Menu as IOSMenu } from './Menu.native'
import { Page, Pager } from './Pager.native'
import { Popover } from './Popover.native'
import {
  NavigationStack,
  Toolbar,
  ToolbarItem,
  ToolbarItemGroup,
  ToolbarSpacer,
} from './NavigationStack.native'
import { NavigationSplitView } from './NavigationSplitView.native'
import { FullScreenCover, Sheet } from './Sheet.native'
import { ArrangementView } from './ArrangementView.native'
import { withAnimation } from './withAnimation.native'
import { KeyframeAnimator, PhaseAnimator } from './Animators.native'
import { CubicKeyframe, KeyframeTrack, LinearKeyframe, MoveKeyframe, SpringKeyframe } from './keyframes'
import * as Controls from './generated/Controls.native'
import { Map as MapWithControls } from './mapControls.native'
import { Tab, Tabs, TabSection, TabViewBottomAccessory, TabViewSlot } from './Tabs.native'
import { Compose } from './compose'
import * as UI from './effects'
import { Widgets, LiveActivities, WidgetUI } from './widgets/index'

export * from './extras'
export { Storage } from './storage/index.native'
export { KeepAwake, useKeepAwake } from './keep-awake/index'
export { Print } from './print/index'
export { StoreReview } from './store-review/index'
export { QuickActions } from './quick-actions/index'
export type { QuickActionItem } from './quick-actions/index'
export type { PrintResult } from './print/index'
// the package root keeps the navigation toolbar's props under the plain name; the SwiftUI
// toolbar item's props are the generated ToolbarItemProps, reachable through Swift.ToolbarItem.
export type { ToolbarHostProps, ToolbarItemProps } from './extras'
export {
  useSizeClass,
  getSizeClass,
  useHinge,
  getHinge,
  onHingeChange,
  ReservedRegions,
  useReservedRegions,
  useReservedRegionsReady,
  useWindowSegments,
  useSpanning,
} from './adaptive/index.native'
export type {
  UserInterfaceSizeClass,
  SizeClass,
  HingeStatus,
  HingeState,
  ReservedRegionKind,
  ReservedRegion,
  WindowSegment,
  ReservedRegionOptions,
  ReservedRegionsProviderProps,
} from './adaptive/types'
export type {
  ArrangementViewProps,
  ArrangementPaneProps,
  ArrangementViewStyle,
  SplitLayoutRatio,
  SplitLayoutSize,
  SplitFixedLayoutSize,
  OverlayArrangementEdge,
} from './ArrangementView.native'

const Menu = Platform.OS === 'android' ? AndroidMenu : IOSMenu
const ContextMenu = Platform.OS === 'android' ? AndroidContextMenu : IOSContextMenu

export const Swift =
  Platform.OS === 'ios'
    ? {
        ArrangementView,
        Tabs,
        Tab,
        TabSection,
        TabViewBottomAccessory,
        TabViewSlot,
        Menu,
        ContextMenu,
        Sheet,
        FullScreenCover,
        Popover,
        Host,
        HStack,
        VStack,
        ZStack,
        Form,
        Section,
        Glass,
        GlassEffectContainer,
        GeometryReader,
        LabeledContent,
        Button,
        List,
        ScrollView,
        ScrollViewReader,
        LazyVStack,
        LazyHStack,
        LazyVGrid,
        LazyHGrid,
        Grid,
        GridRow,
        ControlGroup,
        DisclosureGroup,
        Divider,
        Link,
        Group,
        GroupBox,
        ViewThatFits,
        Overlay,
        ViewSlot,
        SwipeActions,
        Pager,
        Page,
        NavigationStack,
        NavigationSplitView,
        Toolbar,
        ToolbarItem,
        ToolbarItemGroup,
        ToolbarSpacer,
        Spacer,
        Slot,
        withAnimation,
        PhaseAnimator,
        KeyframeAnimator,
        KeyframeTrack,
        LinearKeyframe,
        SpringKeyframe,
        CubicKeyframe,
        MoveKeyframe,
        ...Controls,
        // the generated map takes no children; the wrapper validates and names
        // the map-controls slot while the native view composes it.
        Map: MapWithControls,
      }
    : UnsupportedSwift
export { Compose }
export { Notifications } from './notifications'
export { Widgets, LiveActivities, WidgetUI }
export { Menu, ContextMenu }
export { useNativeState, type NativeState } from './nativeState'
export { TextInput } from './universal/TextInput/index'
export type {
  TextInputProps,
  TextInputRef,
  TextInputSelection,
} from './universal/TextInput/textInputTypes'
export type * from './types'
export type * from './composeTypes'
export type * from './chartTypes'
export { Haptics } from './haptics/index.native'
export { LaunchScreen } from './launchScreen/index.native'
export { LocalAuthentication } from './local-authentication/index'
export type { LocalAuthenticationStatus } from './local-authentication/index'
export { ProtectedStore } from './protected-store/index'
export type { ProtectedStorePolicy } from './protected-store/index'
export { Location } from './location/index'
export type {
  LocationPermissionStatus,
  LocationPosition,
  LocationPlace,
  LocationRegion,
  LocationWatchError,
  RegionCenter,
  RegionState,
  RegionSubscription,
} from './location/index'
export { FileSystem } from './file-system/index.native'
export type {
  FileDirectories,
  FileEncoding,
  FileEntry,
  FileInfo,
} from './file-system/index.native'
export { Audio } from './audio/index'
export { CameraView } from './camera/index.native'
export type {
  CameraCapturedPicture,
  CameraCode,
  CameraCodeType,
  CameraFacing,
  CameraFlashMode,
  CameraPictureOptions,
  CameraState,
  CameraViewProps,
  CameraViewRef,
} from './camera/index.native'
export type {
  AudioPlaybackState,
  AudioPlaybackStatus,
  AudioPlayer,
  AudioPlayerOptions,
  AudioPlayerSubscription,
  AudioRecordingPermission,
  AudioRecordingResult,
  AudioRecordingState,
  AudioRecordingStatus,
  AudioSource,
  AudioSourceObject,
  AudioStatus,
  PitchCorrectionQuality,
} from './audio/index'
export { Share } from './share/index'
export { Open } from './open/index.native'
export type { OpenShareContent } from './open/index.native'
export type { ShareItem, ShareItemType, ShareResult } from './share/index'
export { PhotoLibrary } from './photo-library/index'
export { MapServices } from './map-services/index'
export type {
  MapCoordinate,
  MapPlace,
  MapRoute,
  MapRouteStep,
  MapSuggestion,
  MapTransport,
} from './map-services/index'
export type {
  PhotoLibraryAsset,
  PhotoLibraryAssetPage,
  PhotoLibraryMediaType,
  PhotoLibraryPermissionStatus,
} from './photo-library/index'
export { AppTracking } from './app-tracking/index'
export { AppIcon } from './app-icon/index'
export type { AppTrackingPermissionStatus } from './app-tracking/index'
export { ScreenOrientation } from './screen-orientation/index'
export type {
  ScreenOrientationLock,
  ScreenOrientationValue,
} from './screen-orientation/index'
export { ScreenCapture, usePreventScreenCapture } from './screen-capture/index'
export type { ScreenCaptureResult, ScreenCaptureState } from './screen-capture/index'
export { Purchases } from './purchases/index'
export type {
  PurchaseProduct,
  PurchaseProductType,
  PurchaseResult,
  PurchaseStatus,
  PurchaseTransaction,
  PurchaseUpdate,
  PurchaseUpdateStatus,
} from './purchases/index'
export { ImageManipulator } from './image-manipulator/index.native'
export type {
  ImageCrop,
  ImageFlip,
  ImageFormat,
  ImageResize,
  ImageManipulatorOptions,
  ImageTransformResult,
} from './image-manipulator/index.native'
export { Device } from './device/index'
export type { DeviceInfo, LocalizationInfo } from './device/index'
export { Motion } from './motion/index.native'
export type {
  MotionAvailability,
  MotionReading,
  MotionSensor,
  MotionVector,
} from './motion/index.native'
export { BackgroundTasks } from './background-tasks/index'
export { AppIntents } from './app-intents/index'
export type { AppIntentHandler } from './app-intents/index'
export type {
  BackgroundTaskContext,
  BackgroundTaskHandler,
} from './background-tasks/index'
export type {
  BackgroundTaskInvocation,
  BackgroundTaskKind,
  PendingBackgroundTask,
} from './background-tasks/index'
export { DeviceAttestation } from './device-attestation/index'
export type { DeviceAttestationAvailability } from './device-attestation/index'
export { Contacts } from './contacts/index'
export type {
  ContactChanges,
  ContactInfo,
  ContactInput,
  ContactPostalAddress,
  ContactPostalAddressInput,
  ContactsPermissionStatus,
} from './contacts/index'
export { Calendar } from './calendar/index'
export type {
  CalendarEvent,
  CalendarEventChanges,
  CalendarEventInput,
  CalendarPermissionStatus,
  ReminderInfo,
  ReminderInput,
} from './calendar/index'
export type { AndroidHaptic, HapticImpact, HapticNotification, HapticsApi } from './haptics/index.native'
export type {
  LaunchScreenApi,
  LaunchScreenHideOptions,
} from './launchScreen/index.native'
export { AppInfo } from './app-info/index.native'
export type { AppInfoApi } from './app-info/index.native'
export { ImagePicker } from './image-picker/index.native'
export { DocumentPicker } from './document-picker/index.native'
export { Database } from './database/index.native'
export type {
  ImagePickerAsset,
  ImagePickerCanceledResult,
  ImagePickerMediaType,
  ImagePickerOptions,
  ImagePickerPermissionResponse,
  ImagePickerResult,
  ImagePickerSuccessResult,
} from './image-picker/index.native'
export type {
  DocumentPickerAsset,
  DocumentPickerCanceledResult,
  DocumentPickerOptions,
  DocumentPickerResult,
  DocumentPickerSuccessResult,
} from './document-picker/index.native'
// One.UI components live here physically: UI.EdgeFade, UI.Blur, UI.Mask.
// the One package re-exports this namespace as One.UI.
export { UI }

export type { PortalProps, PortalHostProps } from './ui/portalTypes'
export type {
  PagerProps,
  PagerRef,
  PagerScrollEvent,
  PagerSelectedEvent,
  PagerScrollStateEvent,
} from './ui/pagerTypes'

export { VNDocumentCameraViewController } from './vision-kit/index'
export type { VNDocumentCameraScan, VNDocumentCameraError, VNDocumentCameraViewControllerDelegate } from './vision-kit/index'

export { MFMailComposeViewController, MFMessageComposeViewController } from './message-ui/index'

export { DataScannerViewController } from './data-scanner/index'
export type { DataScannerOptions, DataScannerViewControllerDelegate, RecognizedItem } from './data-scanner/index'

export { CNContactViewController, CNMutableContact, CNContactStore } from './contact-ui/index'
export type { CNContact, CNKeyDescriptor, CNContactViewControllerOptions, CNContactViewControllerDelegate } from './contact-ui/index'
