// swift-tools-version: 5.6
import PackageDescription

/// This doesn't deal with any source code at all, it just makes it possible for us
/// to use the `swift package` command to from the root of the repo to run SPM
/// plugins.
///
/// See README.md for more information.

let package = Package(
    name: "Suno Plugins",
    platforms: [
        .macOS(.v12),
    ],
    dependencies: [
        .package(url: "https://github.com/AndrewSB/CreateAPI", revision: "25660662"),
    ],
    targets: [
        // .binaryTarget(
        //     name: "create-api",
        //     url: "https://github.com/CreateAPI/CreateAPI/releases/download/0.2.0/create-api.artifactbundle.zip",
        //     checksum: "6f8a3ce099f07eb2655ccaf6f66d8c9a09b74bb2307781c4adec36609ddac009"
        // ),
        .plugin(
            name: "CreateAPI",
            capability: .command(
                intent: .custom(
                    verb: "create-api",
                    description: "Generates the OpenAPI entities and paths using CreateAPI"
                ),
                permissions: [
                    .writeToPackageDirectory(reason: "To output the generated source code"),
                ]
            ),
            dependencies: [
                // .target(name: "create-api"),
                .product(name: "create-api", package: "CreateAPI"),
            ],
            path: "Plugins/CreateAPI"
        ),
    ]
)
