import UIKit
import ComplyCubeMobileSDK

/// Wraps the vendor SDK UI in a modal UINavigationController
/// and guarantees clean dismissal on any terminal outcome.
final class ComplyCubeFlowHost: UINavigationController {

  private var didFinish = false
  private weak var presentingVC: UIViewController?

  init(root: UIViewController,
       presenter: UIViewController,
       onComplete: @escaping () -> Void) {
    self.presentingVC = presenter
    super.init(rootViewController: root)

    modalPresentationStyle = .fullScreen // predictable dismissal, no sheet quirks
    isModalInPresentation = false        // allow swipe-to-dismiss unless your policy forbids it
    navigationBar.isTranslucent = false
  }

  required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }

}
