import React from 'react';
import type { ViewProps } from 'react-native';
import NativeBBCastMiniControlsView from './specs/BBCastMiniControlsViewNativeComponent';
import { isCastViewAvailable } from './castAvailability';

export interface BBCastMiniControlsProps extends ViewProps {}

/**
 * BBCastMiniControls - Native ChromeCast mini controller that shows during casting.
 *
 * Renders the native Google Cast SDK mini controller (GCKUIMiniMediaControlsViewController
 * on iOS, MiniControllerFragment on Android). Automatically shows playback controls when
 * content is being cast. Renders nothing if the native Cast SDK is not available.
 */
const BBCastMiniControls: React.FC<BBCastMiniControlsProps> = (props) => {
  if (!isCastViewAvailable('BBCastMiniControlsView')) return null;
  return <NativeBBCastMiniControlsView {...props} />;
};

BBCastMiniControls.displayName = 'BBCastMiniControls';

export default BBCastMiniControls;
