// swift-tools-version:5.9
//
// CxWebAppMac — a native macOS shell that wraps the C++ Crow backend
// in a WKWebView with proper window chrome, menu commands, and settings.
//
// Build:    swift build -c release
// Run:      .build/release/CxWebAppMac
// Bundle:   bash scripts/build-app.sh   (produces CxWebAppMac.app)
//
import PackageDescription

let package = Package(
    name: "CxWebAppMac",
    platforms: [.macOS(.v13)],
    products: [
        .executable(name: "CxWebAppMac", targets: ["CxWebAppMac"]),
    ],
    dependencies: [
        .package(url: "https://cxai-studio.com/git/CxAI-Project/CxLLM-SDK.git",   branch: "main"),
        .package(url: "https://cxai-studio.com/git/CxAI-Project/CxLLM-Drive.git", branch: "main"),
    ],
    targets: [
        .executableTarget(
            name: "CxWebAppMac",
            dependencies: [
                .product(name: "CxCode",        package: "CxLLM-SDK"),
                .product(name: "CxAWS",         package: "CxLLM-SDK"),
                .product(name: "CxGit",         package: "CxLLM-SDK"),
                .product(name: "CxAgent",       package: "CxLLM-SDK"),
                .product(name: "CxMCP",         package: "CxLLM-SDK"),
                .product(name: "CxModels",      package: "CxLLM-SDK"),
                .product(name: "CxChat",        package: "CxLLM-SDK"),
                .product(name: "CxSPARenderer", package: "CxLLM-SDK"),
                .product(name: "CxInstrument",  package: "CxLLM-SDK"),
                .product(name: "CxLangBridge",  package: "CxLLM-SDK"),
                .product(name: "CxARA",         package: "CxLLM-SDK"),
                .product(name: "CxDrive",       package: "CxLLM-Drive"),
            ],
            path: "Sources/CxWebAppMac",
            linkerSettings: [
                .linkedFramework("AppKit"),
                .linkedFramework("SwiftUI"),
                .linkedFramework("WebKit"),
                .linkedFramework("Combine"),
            ]
        ),
        .testTarget(
            name: "CxWebAppMacTests",
            dependencies: ["CxWebAppMac"],
            path: "Tests/CxWebAppMacTests"
        ),
    ]
)
