// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Kagi",
    platforms: [
        .macOS(.v13),
    ],
    products: [
        .executable(name: "kg", targets: ["Kagi"]),

        .library(name: "FastGPT", targets: ["FastGPT"]),
        .library(name: "Search", targets: ["Search"]),
        .library(name: "Summarize", targets: ["Summarize"]),

        .library(name: "Domain", targets: ["Domain"]),
        .library(name: "Toolbox", targets: ["Toolbox"]),
    ],
    dependencies: [
        .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0"),
    ],
    targets: [
        .executableTarget(
            name: "Kagi",
            dependencies: [
                "FastGPT",
                "Search",
                "Summarize",
                .product(name: "ArgumentParser", package: "swift-argument-parser"),
            ]
        ),

        // MARK: - Commands

        .target(
            name: "FastGPT",
            dependencies: [
                "Domain",
            ]
        ),

        .target(
            name: "Search",
            dependencies: [
                "Domain",
                "Toolbox",
            ]
        ),

        .target(
            name: "Summarize",
            dependencies: [
                "Domain",
                "Toolbox",
                .product(name: "ArgumentParser", package: "swift-argument-parser"),
            ]
        ),

        // MARK: - Shared libraries

        .target(
            name: "Domain",
            dependencies: [
                "Toolbox",
            ]
        ),

        .target(
            name: "Toolbox",
            dependencies: [
                .product(name: "ArgumentParser", package: "swift-argument-parser"),
            ]
       ),
    ]
)