//
//  CooperationOrderAccessView.swift
//  suixinkan
//
//  Created by Codex on 2026/6/29.
//

import SwiftUI

/// 合作订单权限入口，无权限时提示并返回。
struct CooperationOrderAccessView: View {
    @EnvironmentObject private var permissionContext: PermissionContext
    @EnvironmentObject private var toastCenter: ToastCenter
    @Environment(\.dismiss) private var dismiss

    var body: some View {
        Group {
            if CooperationOrderFeature.canAccess(permissionContext: permissionContext) {
                CooperationOrderListView()
            } else {
                Color.clear
                    .onAppear {
                        toastCenter.show("暂无合作订单权限")
                        dismiss()
                    }
            }
        }
    }
}
