//
//  LNBottomSheetMenu+Feed.swift
//  Gami
//
//  Created by OneeChan on 2026/3/4.
//

import Foundation


extension LNBottomSheetMenu {
    static func showFeedMenu(detail: LNFeedDetailVO, view: UIView) {
        let panel = LNBottomSheetMenu()
        let menu: [String] = [
            detail.userNo.isMyUid == true ? .init(key: "A00307") : .init(key: "A00043"),
            .init(key: "A00003")
        ]
        panel.update(menu) { [weak view] index, _ in
            guard let view else { return }
            if index == 0 {
                if detail.userNo.isMyUid {
                    let alert = LNCommonAlertView()
                    alert.titleLabel.text = .init(key: "A00308")
                    alert.showConfirm { [weak view] in
                        guard let view else { return }
                        LNFeedManager.shared.deleteFeed(id: detail.id) { [weak view] success in
                            guard let view else { return }
                            guard success else { return }
                            view.navigationController?.popViewController(animated: true)
                        }
                    }
                    alert.showCancel()
                    alert.popup()
                } else {
                    view.pushToReport(uid: detail.userNo)
                }
            }
        }
        panel.popup()
    }
}
