import type { ExpoConfig } from 'expo/config';

const APP_ENV = (process.env.EXPO_PUBLIC_APP_ENV ?? 'dev') as 'dev' | 'prod';

const config: ExpoConfig = {
  name: 'Flowy',
  slug: 'flowy',
  version: '0.1.0',
  orientation: 'portrait',
  icon: './assets/icon.png',
  scheme: 'flowy',
  userInterfaceStyle: 'dark',
  newArchEnabled: true,
  splash: {
    image: './assets/icon.png',
    resizeMode: 'contain',
    backgroundColor: '#2B2B2B',
  },
  ios: {
    supportsTablet: true,
    bundleIdentifier: 'ai.flowylabs.llink',
    infoPlist: {
      ITSAppUsesNonExemptEncryption: false,
    },
  },
  android: {
    adaptiveIcon: {
      foregroundImage: './assets/icon.png',
      backgroundColor: '#2B2B2B',
    },
  },
  plugins: [
    [
      'expo-build-properties',
      {
        ios: {
          deploymentTarget: '16.0',
        },
      },
    ],
    'expo-secure-store',
    [
      'expo-camera',
      {
        cameraPermission: 'Flowy uses your camera to record video messages.',
        microphonePermission:
          'Flowy uses your microphone to record voice and video messages.',
        recordAudioAndroid: true,
      },
    ],
    [
      'expo-audio',
      {
        microphonePermission:
          'Flowy uses your microphone to record voice messages.',
      },
    ],
    [
      'expo-image-picker',
      {
        photosPermission:
          'Flowy uses your photo library to set your profile picture.',
      },
    ],
    [
      'expo-notifications',
      {
        icon: './assets/notification-icon.png',
        color: '#000000',
      },
    ],
    // LiveKit needs WebRTC native modules. The two plugins below patch the
    // iOS/Android prebuild so camera/mic permissions and the webrtc pod are
    // wired up correctly for huddles.
    '@config-plugins/react-native-webrtc',
    '@livekit/react-native-expo-plugin',
  ],
  experiments: {
    typedRoutes: false,
  },
  extra: {
    eas: {
      projectId: 'e902f7e5-e514-42bd-9591-75738e3494ed',
    },

    appEnv: APP_ENV,
  },
};

export default config;
