"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@bluebase/core");
exports.resolveRouteOptions = (route, navigator, mainNavigator, ctx) => {
    // // Extract screenProps
    // const screenProps: ScreenProps = {
    // 	...mainNavigator.screenProps,
    // 	...params.screenProps
    // };
    // Create navigationOptions from main navigation configs
    let navigationOptions = core_1.resolveThunk(mainNavigator.defaultNavigationOptions || {}, Object.assign(Object.assign({}, ctx), { navigationOptions: {} }));
    // Create navigationOptions from navigatior defaultNavigationOptions
    navigationOptions = core_1.resolveThunk(navigator.defaultNavigationOptions || navigationOptions, Object.assign(Object.assign({}, ctx), { navigationOptions }));
    // Now, create navigationOptions from route's navigationOptions object
    navigationOptions = core_1.resolveThunk(route.options || route.navigationOptions || navigationOptions, Object.assign(Object.assign({}, ctx), { navigationOptions }));
    // And finally, create navigationOptions from route.screen NavigationOptions
    navigationOptions = core_1.resolveThunk((route.screen && route.screen.navigationOptions) || navigationOptions, Object.assign(Object.assign({}, ctx), { navigationOptions }));
    // Phew...
    return navigationOptions;
};
