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

import PackageDescription

let commonSwiftSettings: [SwiftSetting] = [
    .enableExperimentalFeature("StrictConcurrency"),
    .enableUpcomingFeature("InferIsolatedConformances"),
    .enableUpcomingFeature("NonisolatedNonsendingByDefault"),
    .defaultIsolation(nil),
    .swiftLanguageMode(.v6)
]

let tcaDependency = Target.Dependency.product(name: "ComposableArchitecture", package: "swift-composable-architecture")

let package = Package(
    name: "Meow",
    platforms: [.iOS(.v18), .macOS(.v15)],
    products: [
        .library(name: "CatFactsKit", targets: ["CatFactsKit"]),
        .library(name: "Core", targets: ["Core"]),
        .library(name: "Root", targets: ["Root"]),
        .library(name: "Facts", targets: ["Facts"])
    ],
    dependencies: [
        .package(url: "https://github.com/WeTransfer/Mocker", from: "3.0.2"),
        .package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "1.23.1"),
    ],
    targets: [
        .target(
            name: "CatFactsKit",
            swiftSettings: commonSwiftSettings
        ),
        .target(
            name: "Core",
            dependencies: ["CatFactsKit", tcaDependency],
            swiftSettings: commonSwiftSettings
        ),
        .target(
            name: "Root",
            dependencies: ["CatFactsKit", "Core", "Facts", tcaDependency],
            swiftSettings: commonSwiftSettings
        ),
        .target(
            name: "Facts",
            dependencies: ["CatFactsKit", "Core", tcaDependency],
            swiftSettings: commonSwiftSettings
        ),
        .testTarget(
            name: "CatFactsKitTests",
            dependencies: ["CatFactsKit", "Mocker"],
            resources: [.process("Fixtures")],
            swiftSettings: commonSwiftSettings
        ),
    ]
)
