// swift-tools-version: 6.2
//
// DS multidevice app — unified package (S2 AIFabric + S3 app), one repo / one manifest.
//
// AIFabric (Sources/AI, S2-owned) is compiled exactly once as a single target here, so the
// "소비모델 b" duplicate-symbol concern (two packages each compiling Sources/AI) does not arise.
// It is also exposed as a library product so a future separate app package could depend on it.
//
// Ownership boundary unchanged: S2 owns Sources/AI/** + Tests/AITests/**; S3 owns DSKit / AppFeature
// / Tests/DSKitTests. S3 consumes AIFabric read-only.
//
// A-6 (Xcode .app target via xcodegen): the runnable macOS app shell lives in App/DSApp.swift, owned
// by the xcodegen "DSApp" application target (project.yml), NOT by SPM. SPM here builds only the
// libraries + tests, so `swift build` / `swift test` stay backend-free and the executable lives in
// the real .app bundle (Info.plist + entitlements) where Cmd+R actually opens a window. The App
// target depends on the AppFeature library product below.
import PackageDescription

let package = Package(
    name: "DSApp",
    platforms: [
        .macOS(.v26), // FoundationModels (OnDeviceProvider) + 3-column NavigationSplitView
    ],
    products: [
        .library(name: "AIFabric", targets: ["AIFabric"]),
        // Consumed by the xcodegen "DSApp" .app target (App/DSApp.swift).
        .library(name: "AppFeature", targets: ["AppFeature"]),
    ],
    targets: [
        .target(
            name: "AIFabric",
            path: "Sources/AI",
            swiftSettings: [.swiftLanguageMode(.v6)]
        ),
        .target(
            name: "DSKit",
            resources: [.process("Resources")],
            swiftSettings: [.swiftLanguageMode(.v6)]
        ),
        .target(
            name: "AppFeature",
            dependencies: ["DSKit", "AIFabric"],
            swiftSettings: [.swiftLanguageMode(.v6)]
        ),
        .testTarget(
            name: "DSKitTests",
            dependencies: ["DSKit", "AIFabric"],
            swiftSettings: [.swiftLanguageMode(.v6)]
        ),
        .testTarget(
            name: "AppFeatureTests",
            dependencies: ["AppFeature", "DSKit"],
            swiftSettings: [.swiftLanguageMode(.v6)]
        ),
        .testTarget(
            name: "AITests",
            dependencies: ["AIFabric"],
            path: "Tests/AITests",
            swiftSettings: [.swiftLanguageMode(.v6)]
        ),
    ]
)
