import { useMainStore } from '@/store';
import BailoutCode from '@/constants/bailoutCode';
import issPageValues from '@/router/router-constants/issPage-values';

function canBailoutNavigateBack() {
    const code = useMainStore().pageData(issPageValues.BAILOUT_PAGE)?.bailoutCode;
    if (code == null) {
        return true;
    }

    switch (code) {
        case BailoutCode.VehicleNotFound:
        case BailoutCode.DoNotSeeMyShop:
        case BailoutCode.TPANotEnabled:
            return true;

        default:
            return false;
    }
}

export default canBailoutNavigateBack;
