// swift-tools-version: 6.0

import PackageDescription

let package = Package(
    name: "wingsdkios_spm",
    platforms: [
        .iOS(.v12)
    ],
    products: [
        .library(name: "WASdkIntf", targets: ["WASdkIntf"]),
        .library(name: "WASdkImpl", targets: ["WASdkImpl"]),
        .library(name: "WAPushImpl", targets: ["WAPushImpl"]),
        .library(name: "WAAiHelpImpl", targets: ["WAAiHelpImpl"]),
//        .library(name: "WAAdmobImpl", targets: ["WAAdmobImpl"]),
        .library(name: "WAAfImpl", targets: ["WAAfImpl"]),
        .library(name: "WAApImpl", targets: ["WAApImpl"]),
        .library(name: "WAFbImpl", targets: ["WAFbImpl"]),
        .library(name: "WAFirebaseImpl", targets: ["WAFirebaseImpl"]),
    ],
    targets: [

        // MARK: - WASdkIntf
        .binaryTarget(name: "WASdkIntfBinary", path: "./WASdkIntf/WASdkIntf.xcframework"),
        .target(
            name: "WASdkIntf",
            dependencies: ["WASdkIntfBinary"],
            path: "Sources/WASdkIntf",
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")]
        ),


        // MARK: - WASdkImpl
        .binaryTarget(
            name: "AFNetworking",
            path: "./WASdkImpl/AFNetworking.xcframework"
        ),
        .binaryTarget(
            name: "WASdkImplBinary",
            path: "./WASdkImpl/WASdkImpl.xcframework"
        ),
        .binaryTarget(
            name: "FMDB",
            path: "./WASdkImpl/FMDB.xcframework"
        ),
        .binaryTarget(
            name: "Toast",
            path: "./WASdkImpl/Toast.xcframework"
        ),
        .binaryTarget(
            name: "WACommon",
            path: "./WASdkImpl/WACommon.xcframework"
        ),
        .binaryTarget(
            name: "Didomi",
            path: "./WASdkImpl/Didomi.xcframework"
        ),
        .target(
            name: "WASdkImpl",
            dependencies: [
                "WASdkImplBinary",
                "AFNetworking",
                "FMDB",
                "Toast",
                "WACommon",
                "Didomi"
            ],
            path: "Sources/WASdkImpl",
            resources: [.copy("config/wa_sdk_impl_config_winga.xml")],
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")]
        ),

        // MARK: - WAAiHelpImpl
        .binaryTarget(name: "AIHelpSupportSDK", path: "./WAAiHelpImpl/AIHelpSupportSDK.xcframework"),
        .binaryTarget(name: "WAAiHelpImplBinary", path: "./WAAiHelpImpl/WAAIhelpImpl.xcframework"),
        .target(
            name: "WAAiHelpImpl",
            dependencies: ["AIHelpSupportSDK", "WAAiHelpImplBinary"],
            path: "Sources/WAAiHelpImpl",
            resources: [.copy("config/wa_sdk_impl_config_aihelp.xml")],
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")],
            linkerSettings: [.linkedFramework("PhotosUI")]
        ),

        // MARK: - WAAdmobImpl
//        .binaryTarget(name: "WAAdmobImplBinary", path: "./WAAdmobImpl/WAAdmobImpl.xcframework"),
//        .binaryTarget(name: "GoogleMobileAds", path: "./WAAdmobImpl/GoogleMobileAds.xcframework"),
//        .binaryTarget(name: "UserMessagingPlatform", path: "./WAAdmobImpl/UserMessagingPlatform.xcframework"),
//        .target(
//            name: "WAAdmobImpl",
//            dependencies: ["WAAdmobImplBinary", "GoogleMobileAds", "UserMessagingPlatform"],
//            path: "Sources/WAAdmobImpl",
//            resources: [.process("config/wa_sdk_impl_config_admob.xml")],
//            publicHeadersPath: ".",
//            cSettings: [.headerSearchPath(".")]
//        ),

        // MARK: - WAAfImpl
        .binaryTarget(name: "WAAfImplBinary", path: "./WAAfImpl/WAAfImpl.xcframework"),
        .binaryTarget(name: "AppsFlyerLib", path: "./WAAfImpl/AppsFlyerLib.xcframework"),
        .target(
            name: "WAAfImpl",
            dependencies: ["WAAfImplBinary", "AppsFlyerLib"],
            path: "Sources/WAAfImpl",
            resources: [.process("config/wa_sdk_impl_config_appsflyer.xml")],
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")]
        ),

        // MARK: - WAApImpl
        .binaryTarget(name: "WAApImplBinary", path: "./WAApImpl/WAApImpl.xcframework"),
        .target(
            name: "WAApImpl",
            dependencies: ["WAApImplBinary"],
            path: "Sources/WAApImpl",
            resources: [.process("config/wa_sdk_impl_config_apple.xml")],
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")]
        ),

        // MARK: - WAFbImpl
        .binaryTarget(name: "WAFbImplBinary", path: "./WAFbImpl/WAFbImpl.xcframework"),
        .binaryTarget(name: "FBAEMKit", path: "./WAFbImpl/FBAEMKit.xcframework"),
        .binaryTarget(name: "FBSDKCoreKit", path: "./WAFbImpl/FBSDKCoreKit.xcframework"),
        .binaryTarget(name: "FBSDKCoreKit_Basics", path: "./WAFbImpl/FBSDKCoreKit_Basics.xcframework"),
        .binaryTarget(name: "FBSDKGamingServicesKit", path: "./WAFbImpl/FBSDKGamingServicesKit.xcframework"),
        .binaryTarget(name: "FBSDKLoginKit", path: "./WAFbImpl/FBSDKLoginKit.xcframework"),
        .binaryTarget(name: "FBSDKShareKit", path: "./WAFbImpl/FBSDKShareKit.xcframework"),
        .target(
            name: "WAFbImpl",
            dependencies: [
                "WAFbImplBinary",
                "FBAEMKit",
                "FBSDKCoreKit",
                "FBSDKCoreKit_Basics",
                "FBSDKGamingServicesKit",
                "FBSDKLoginKit",
                "FBSDKShareKit"
            ],
            path: "Sources/WAFbImpl",
            resources: [.process("config/wa_sdk_impl_config_facebook.xml")],
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")],
            linkerSettings: [.linkedFramework("Accelerate")]
        ),

        


        
        
        // MARK: - WAFirebaseImpl
        .binaryTarget(name: "WAFirebaseImplBinary", path: "./WAFirebaseImpl/WAFirebaseImpl.xcframework"),
        .binaryTarget(name: "FBLPromises", path: "./WAFirebaseImpl/FBLPromises.xcframework"),
        .binaryTarget(name: "FirebaseAnalytics", path: "./WAFirebaseImpl/FirebaseAnalytics.xcframework"),
        .binaryTarget(name: "FirebaseCore", path: "./WAFirebaseImpl/FirebaseCore.xcframework"),
        .binaryTarget(name: "FirebaseCoreInternal", path: "./WAFirebaseImpl/FirebaseCoreInternal.xcframework"),
        .binaryTarget(name: "FirebaseInstallations", path: "./WAFirebaseImpl/FirebaseInstallations.xcframework"),
        .binaryTarget(name: "GoogleAppMeasurement", path: "./WAFirebaseImpl/GoogleAppMeasurement.xcframework"),
        .binaryTarget(name: "GoogleAppMeasurementIdentitySupport", path: "./WAFirebaseImpl/GoogleAppMeasurementIdentitySupport.xcframework"),
        .binaryTarget(name: "GoogleUtilities", path: "./WAFirebaseImpl/GoogleUtilities.xcframework"),
        .binaryTarget(name: "GoogleAdsOnDeviceConversion", path: "./WAFirebaseImpl/GoogleAdsOnDeviceConversion.xcframework"),

        
        .binaryTarget(name: "nanopb", path: "./WAFirebaseImpl/nanopb.xcframework"),
        .target(
            name: "WAFirebaseImpl",
            dependencies: [
                "WAFirebaseImplBinary",
                "FBLPromises",
                "FirebaseAnalytics",
                "FirebaseCore",
                "FirebaseCoreInternal",
                "FirebaseInstallations",
                "GoogleAppMeasurement",
                "GoogleAppMeasurementIdentitySupport",
                "GoogleUtilities",
                "nanopb",
                "GoogleAdsOnDeviceConversion",

            ],
            path: "Sources/WAFirebaseImpl",
            resources: [.process("config")],
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")]
        ),

        // MARK: - WAPushImpl
        .binaryTarget(name: "WAPushImplBinary", path: "./WAPushImpl/WAPushImpl.xcframework"),
        .target(
            name: "WAPushImpl",
            dependencies: ["WAPushImplBinary"],
            path: "Sources/WAPushImpl",
            resources: [.process("config/wa_sdk_impl_config_push.xml")],
            publicHeadersPath: ".",
            cSettings: [.headerSearchPath(".")]
        ),


    ]
)
