import XCTest
@testable import ByteLystPlatformSDK

final class BLFeatureFlagClientTests: XCTestCase {

    private func makeClient() -> BLFeatureFlagClient {
        let config = BLPlatformConfig(
            productId: "testapp",
            baseURL: "http://localhost:4003",
            bundleId: "com.bytelyst.test"
        )
        let platformClient = BLPlatformClient(config: config)
        return BLFeatureFlagClient(config: config, client: platformClient)
    }

    func testDefaultFlagsEmpty() {
        let client = makeClient()
        XCTAssertEqual(client.allFlags().count, 0)
    }

    func testIsEnabledReturnsFalseForUnknownKey() {
        let client = makeClient()
        XCTAssertFalse(client.isEnabled("nonexistent_flag"))
    }

    func testStopDoesNotCrash() {
        let client = makeClient()
        client.stop()
        client.stop() // Double stop
    }
}
