package com.fabledsword.minstrel.player.output.upnp

import org.junit.jupiter.api.Test
import kotlin.test.assertEquals

class BareUdnTest {

    @Test
    fun `strips uuid prefix`() {
        assertEquals("RINCON_ABC", "uuid:RINCON_ABC".bareUdn())
    }

    @Test
    fun `strips MR suffix`() {
        assertEquals("RINCON_ABC", "RINCON_ABC_MR".bareUdn())
    }

    @Test
    fun `strips MS suffix`() {
        assertEquals("RINCON_ABC", "RINCON_ABC_MS".bareUdn())
    }

    @Test
    fun `strips both uuid prefix and MR suffix`() {
        assertEquals("RINCON_ABC", "uuid:RINCON_ABC_MR".bareUdn())
    }

    @Test
    fun `strips both uuid prefix and MS suffix`() {
        assertEquals("RINCON_ABC", "uuid:RINCON_ABC_MS".bareUdn())
    }

    @Test
    fun `leaves already bare UDN unchanged`() {
        assertEquals("RINCON_ABC", "RINCON_ABC".bareUdn())
    }

    @Test
    fun `MR suffix comparison crosses MediaRenderer vs ZGT response`() {
        val routeId = "uuid:RINCON_5CAAFD794B6401400_MR"
        val zgtMemberUdn = "RINCON_5CAAFD794B6401400"
        assertEquals(routeId.bareUdn(), zgtMemberUdn.bareUdn())
    }
}
