"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NATIVE_CONTEXT = exports.MobileContextType = void 0;
const mablscriptFind_1 = require("@mablhq/test-model/mablscriptFind");
var MobileContextType;
(function (MobileContextType) {
    MobileContextType["androidWebView"] = "ANDROID_WEBVIEW";
    MobileContextType["iOSWebView"] = "IOS_WEBVIEW";
    MobileContextType["native"] = "NATIVE";
})(MobileContextType || (exports.MobileContextType = MobileContextType = {}));
exports.NATIVE_CONTEXT = {
    contextType: MobileContextType.native,
};
const DEFAULT_FIND_STRATEGY_TIMEOUT_MS = 3_000;
class FindStrategy {
    constructor() { }
    sleep(ms) {
        return new Promise((resolve) => global.setTimeout(resolve, ms));
    }
    isApplicable(descriptor) {
        return !(0, mablscriptFind_1.isWebViewFindElementDescriptor)(descriptor);
    }
    getFindTimeout() {
        return DEFAULT_FIND_STRATEGY_TIMEOUT_MS;
    }
    getPlatformSelector(descriptor) {
        const { selector } = descriptor.findTarget;
        if (selector.iOS && selector.android) {
            throw new Error('Expected only one platform type to be set.');
        }
        return selector.android ?? selector.iOS;
    }
}
exports.default = FindStrategy;
