//
//  LNCommonAlertView+Order.swift
//  Lanu
//
//  Created by OneeChan on 2025/12/23.
//

import Foundation


extension LNCommonAlertView {
    static func showCancelOrderAlert(orderId: String, completion: ((Bool) -> Void)? = nil) {
        let panel = LNCommonAlertView()
        panel.titleLabel.text = .init(key: "A00021")
        panel.showConfirm(.init(key: "A00022")) { }
        panel.showCancel(.init(key: "A00023")) {
            LNOrderManager.shared.cancelOrder(orderId: orderId) { success in
                completion?(success)
            }
        }
        panel.popup()
    }
    
    static func showFinishOrderAlert(orderId: String, completion: ((Bool) -> Void)? = nil) {
        let panel = LNCommonAlertView()
        panel.titleLabel.text = .init(key: "A00024")
        panel.showConfirm(.init(key: "A00025")) {
            LNOrderManager.shared.finishOrder(orderId: orderId) { success in
                completion?(success)
            }
        }
        panel.showCancel(.init(key: "A00003")) { }
        panel.popup()
    }
}
