import SwiftUI

@main
struct BREDAPBRStudioApp: App {
    @NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
    @StateObject private var materialStore = MaterialStore()
    @StateObject private var normalStore = NormalGeneratorStore()

    var body: some Scene {
        WindowGroup("BREDA TECH PBR Studio") {
            ContentView(
                materialStore: materialStore,
                normalStore: normalStore
            )
                .frame(minWidth: 1120, minHeight: 720)
        }
        .commands {
            CommandMenu("Material") {
                Button("Export PBR Set...") {
                    materialStore.exportMaterialSet()
                }
                .keyboardShortcut("e", modifiers: [.command])
                .disabled(!materialStore.canExport)

                Button("Build Preview") {
                    materialStore.buildPreview()
                }
                .keyboardShortcut("r", modifiers: [.command])
                .disabled(!materialStore.hasAnyTexture)

                Divider()

                Button("Reset Inputs") {
                    materialStore.reset()
                }
                .keyboardShortcut(.delete, modifiers: [.command])
                .disabled(!materialStore.hasAnyTexture)
            }
        }
    }
}
