package com.jordanbot.autoride.parser

import com.jordanbot.autoride.model.RideRequest

class TaxiFParser : NotificationParser {
    override val packageName = "com.taxif.driver"

    override fun parse(title: String, text: String): RideRequest? {
        var price: Double? = null

        val priceRegex = """(\d+\.?\d*)\s*(JOD|د\.أ)""".toRegex()

        val fullText = "$title $text"

        priceRegex.find(fullText)?.let {
            price = it.groupValues[1].toDoubleOrNull()
        }

        return RideRequest(
            appPackage = packageName,
            priceJod = price,
            minutesAway = null,
            distanceKm = null,
            title = title,
            text = text
        )
    }
}
