//
//  LNReportManager.swift
//  Lanu
//
//  Created by OneeChan on 2025/12/31.
//

import Foundation


class LNReportManager {
    static let shared = LNReportManager()
    static let reportExtraMaxInput = 200
    static let helpCenterMaxInput = 200
    
    private init() { }
    
    func reportUser(uid: String, content: String, photos: [String],
                    queue: DispatchQueue = .main,
                    handler: @escaping (Bool) -> Void) {
        LNHttpManager.shared.reportUser(uid: uid, content: content, photos: photos) { err in
            queue.asyncIfNotGlobal {
                handler(err == nil)
            }
            if let err {
                showToast(err.errorDesc)
            }
        }
    }
    
    func feedback(content: String, photos: [String],
                  queue: DispatchQueue = .main,
                  handler: @escaping (Bool) -> Void) {
        LNHttpManager.shared.feedback(content: content, photos: photos) { err in
            queue.asyncIfNotGlobal {
                handler(err == nil)
            }
            if let err {
                showToast(err.errorDesc)
            }
        }
    }
    
    func reportEvent(event: LNReportEvent) {
        LNHttpManager.shared.reportEvent(event: event) { _ in }
    }
}
