let routefunctions = {
    getLineColors(leg){
        let line = leg?.line
        if (!line){
            return (['black', 'white']);
        } else if (line.productName === "STB"){
            return (['white', 'blue']);
        } else if (line.productName === "S"){
            return (['white', 'green']);
        } else if (line.productName === "RE" || line.productName === "RB" || line.productName === "R"){
            return (['white', 'red']);
        } else if (line.productName === "IR"){
            return (['green', 'white']);
        } else if (line.productName === "IC" || line.productName === "ICE" || line.productName === "RJ" || line.productName === "RJX"){
            return (['red', 'white']);
        } else if (line.productName === "EC" || line.productName === "ECE"){
            return (['blue', 'white']);
        } else if (line.productName === "MEX"){
            return (['black', 'yellow']);
        } else if (line.productName === "EST"){
            return (['yellow', 'blue']);
        } else if (line.productName === "TGV"){
            return (['IndianRed', 'white']);
        } else if (line.productName === "EN"){
            return (['white', 'navy']);
        } else {
            console.log(line.productName)
            return (['black', 'white']);
        }
    },
    getRouteNumber(leg){
        if (!leg) {
            console.log(leg)
            return ""
        } else if (leg.walking){
            return "";
        } else if (leg.line){
            if (leg.line.name) {
                if (leg.line.fahrtNr && leg.line.name.endsWith(leg.line.fahrtNr)){
                    return leg.line.name.replace(leg.line.fahrtNr, "").trim();
                } else {
                    return leg.line.name;
                }
            } else if(leg.line.product){
                if (leg.line.product === 'regionalExpress'){
                    return "REX"
                } else if (leg.line.product === 'regional'){
                    return "REG"
                } else if (leg.line.product === 'national'){
                    return "NAT"
                } else {
                    console.log(leg)
                    return ""
                }
            } else {
                console.log(leg)
                return ""
            }
        } else {
            console.log(leg)
            return ""
        }
    }
}
export default routefunctions;
