package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos

object ZeppOsDeviceSources {
    // jq '.[] | [.value.productId, .value.productVersion, .deviceSource] | @csv' -r devices.json | \
    //     sed 's/,/, /g; s/^/ZeppOsDeviceInfo(/; s/$/),/'
    // TODO: A few are missing: mi band 7, amazfit band 7, amazfit gtr mini
    val DEVICE_SOURCES = listOf(
        ZeppOsDeviceInfo(94, 256, 224),
        ZeppOsDeviceInfo(94, 257, 225),
        ZeppOsDeviceInfo(95, 256, 226),
        ZeppOsDeviceInfo(95, 257, 227),
        ZeppOsDeviceInfo(93, 256, 229),
        ZeppOsDeviceInfo(93, 257, 230),
        ZeppOsDeviceInfo(105, 257, 242),
        ZeppOsDeviceInfo(115, 256, 246),
        ZeppOsDeviceInfo(115, 259, 247),
        ZeppOsDeviceInfo(116, 257, 251),
        ZeppOsDeviceInfo(117, 259, 254),
        ZeppOsDeviceInfo(103, 256, 260),
        ZeppOsDeviceInfo(103, 257, 261),
        ZeppOsDeviceInfo(103, 258, 262),
        ZeppOsDeviceInfo(103, 259, 263),
        ZeppOsDeviceInfo(103, 260, 264),
        ZeppOsDeviceInfo(103, 261, 265),
        ZeppOsDeviceInfo(103, 262, 266),
        ZeppOsDeviceInfo(63, 256, 414),
        ZeppOsDeviceInfo(63, 257, 415),
        ZeppOsDeviceInfo(113, 256, 418),
        ZeppOsDeviceInfo(113, 257, 419),
        ZeppOsDeviceInfo(93, 258, 6095106),
        ZeppOsDeviceInfo(100, 256, 6553856),
        ZeppOsDeviceInfo(100, 257, 6553857),
        ZeppOsDeviceInfo(103, 263, 6750471),
        ZeppOsDeviceInfo(120, 257, 7864577),
        ZeppOsDeviceInfo(121, 256, 7930112),
        ZeppOsDeviceInfo(121, 257, 7930113),
        ZeppOsDeviceInfo(122, 256, 7995648),
        ZeppOsDeviceInfo(122, 257, 7995649),
        ZeppOsDeviceInfo(124, 256, 8126720),
        ZeppOsDeviceInfo(124, 257, 8126721),
        ZeppOsDeviceInfo(124, 263, 8126727),
        ZeppOsDeviceInfo(125, 256, 8192256),
        ZeppOsDeviceInfo(125, 257, 8192257),
        ZeppOsDeviceInfo(126, 257, 8257793),
        ZeppOsDeviceInfo(127, 256, 8323328),
        ZeppOsDeviceInfo(127, 257, 8323329),
        ZeppOsDeviceInfo(128, 256, 8388864),
        ZeppOsDeviceInfo(128, 257, 8388865),
        ZeppOsDeviceInfo(129, 256, 8454400),
        ZeppOsDeviceInfo(129, 257, 8454401),
        ZeppOsDeviceInfo(130, 256, 8519936),
        ZeppOsDeviceInfo(130, 257, 8519937),
        ZeppOsDeviceInfo(130, 259, 8519939),
        ZeppOsDeviceInfo(133, 256, 8716544),
        ZeppOsDeviceInfo(133, 257, 8716545),
        ZeppOsDeviceInfo(133, 259, 8716547),
        ZeppOsDeviceInfo(134, 257, 8782081),
        ZeppOsDeviceInfo(134, 264, 8782088),
        ZeppOsDeviceInfo(134, 265, 8782089),
        ZeppOsDeviceInfo(136, 256, 8913152),
        ZeppOsDeviceInfo(136, 257, 8913153),
        ZeppOsDeviceInfo(136, 259, 8913155),
        ZeppOsDeviceInfo(136, 263, 8913159),
        ZeppOsDeviceInfo(144, 257, 9437441),
        ZeppOsDeviceInfo(145, 257, 9502977),
        ZeppOsDeviceInfo(146, 256, 9568512),
        ZeppOsDeviceInfo(146, 257, 9568513),
        ZeppOsDeviceInfo(146, 259, 9568515),
        ZeppOsDeviceInfo(149, 256, 9765120),
        ZeppOsDeviceInfo(149, 257, 9765121),
        ZeppOsDeviceInfo(150, 256, 9830656),
        ZeppOsDeviceInfo(150, 257, 9830657),
        ZeppOsDeviceInfo(150, 259, 9830659),
        ZeppOsDeviceInfo(154, 256, 10092800),
        ZeppOsDeviceInfo(154, 257, 10092801),
        ZeppOsDeviceInfo(154, 259, 10092803),
        ZeppOsDeviceInfo(154, 263, 10092807),
        ZeppOsDeviceInfo(155, 257, 10158337),
        ZeppOsDeviceInfo(156, 256, 10223872),
        ZeppOsDeviceInfo(156, 257, 10223873),
        ZeppOsDeviceInfo(156, 259, 10223875),
        ZeppOsDeviceInfo(160, 256, 10486016),
        ZeppOsDeviceInfo(160, 257, 10486017),
        ZeppOsDeviceInfo(160, 259, 10486019),
        ZeppOsDeviceInfo(161, 256, 10551552),
        ZeppOsDeviceInfo(161, 257, 10551553),
        ZeppOsDeviceInfo(161, 259, 10551555),
        ZeppOsDeviceInfo(162, 259, 10617091),
        ZeppOsDeviceInfo(163, 256, 10682624),
        ZeppOsDeviceInfo(163, 257, 10682625),
        ZeppOsDeviceInfo(163, 259, 10682627),
        ZeppOsDeviceInfo(165, 257, 10813697),
        ZeppOsDeviceInfo(165, 259, 10813699),
        ZeppOsDeviceInfo(166, 256, 10879232),
        ZeppOsDeviceInfo(166, 257, 10879233),
        ZeppOsDeviceInfo(166, 259, 10879235),
        ZeppOsDeviceInfo(167, 256, 10944768),
        ZeppOsDeviceInfo(167, 257, 10944769),
        ZeppOsDeviceInfo(167, 259, 10944771),
        ZeppOsDeviceInfo(167, 4355, 10948867),
    )

    fun resolve(productId: Int, productVersion: Int): ZeppOsDeviceInfo? {
        return DEVICE_SOURCES.firstOrNull { it.productId == productId && it.productVersion == productVersion }
    }
}
