//
//  SpeakEleCorrectViewModel.swift
//  SpeakEasyLearnEnglish
//
//  Created by edy on 2025/8/12.
//

import UIKit

class SpeakEleCorrectViewModel: NSObject {

    let net : SpeakNetHomeViewModel = SpeakNetHomeViewModel()
    
    var dateUpdate:((Any)->Void)?
    
    var correct:SpeakEleCorrectModel? {
        didSet{
            guard let up = dateUpdate else { return }
            up(correct)
        }
    }
    
    func correct(_ msg:String,lessonId:Int) -> Void {
        net.correct(param: ["message":msg,"lessonId":lessonId]) {[weak self] (su, data:SpeakEleCorrectModel?) in
            if su {
                self?.correct = data
            }else{
                self?.correct = nil
            }
            
        }
    }
    
}
