//
//  SwiftComponentManager.swift
//  AwesomeProject3
//
//  Created by Macbook Pro on 02/07/2023.
//

import TPLMaps
import Foundation
import UIKit
import React

@objc(SwiftComponentManager)


class SwiftComponentManager: NSObject, TPLMaps.TPLMapViewDelegate {
  
  
  
  var map : TPLMaps.TPLMapView
  
  override init() {
    
    self.map = TPLMaps.TPLMapView.init()
    
    super.init()
    self.map.delegate = self
  }

@objc
func passValueFromReact(_ value : String) {
  
  print("This is a log message from MySwiftModule")
  map.animateToZoom(zoom: 8)
  showAlert()
 
 }
  
  
  func showAlert() {
    // Create the alert controller
        let alertController = UIAlertController(title: "Alert", message: "This is a simple alert.", preferredStyle: .alert)
        
        // Create the OK action
        let okAction = UIAlertAction(title: "OK", style: .default) { _ in
            // Handle OK button tap
            // You can perform any additional actions here
        }
        
        // Add the OK action to the alert controller
        alertController.addAction(okAction)
        
        // Present the alert controller
        UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true, completion: nil)
  }
  
 
}
