require_relative '../node_modules/react-native/scripts/react_native_pods'

platform :ios, min_ios_version_supported
prepare_react_native_project!

# CashuDevKit framework path
cashudevkit_framework_path = File.join(__dir__, 'Cdk', 'cdkFFI.xcframework')

target 'zeus' do
  config = use_native_modules!


  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  # proto
  pod 'SwiftProtobuf', '~> 1.0'

  # use_unimodules!(modules_paths: ['../node_modules'])

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

  pod 'react-native-blob-util', :path => '../node_modules/react-native-blob-util'

  # CashuDevKit - Cashu wallet FFI bindings (local xcframework)
  pod 'CashuDevKit', :path => '.'

  # ZeusCashuRestore - standalone NUT-13 restore for v1 legacy seeds
  pod 'ZeusCashuRestore', :path => '.'

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  # use_flipper!()

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        # CashuDevKit framework search path
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)']
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '"$(SRCROOT)/Cdk"'
        # Zeus Cashu Restore framework search path
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '"$(SRCROOT)/ZeusRestore"'
        # Lndmobile framework search path
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '"$(SRCROOT)/LncMobile"'
        # Ensure minimum deployment target to suppress Xcode warnings
        if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 13.4
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.4'
        end
      end
    end
  end
end
