//
//  IPAQViewController.swift
//  SAGE_RK_ML
//
//  Created by Juan David Lopez Regalado on 31/01/25.
//

import UIKit
import ResearchKitUI
import ResearchKit

class IPAQViewController: UIViewController, ORKTaskViewControllerDelegate {

    

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
    


    @IBAction func ipaqButton(_ sender: UIButton) {
        let task = IPAQManager.shared.createIPAQ()
        let taskViewController = ORKTaskViewController(task: task, taskRun: nil)
        taskViewController.modalPresentationStyle = .fullScreen
        taskViewController.delegate = self
        present(taskViewController, animated: true, completion: nil)
    }
    
    func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) {
        taskViewController.dismiss(animated: true, completion: nil)

    }
}
