
function verifyRedFixes() {
    console.log("--- Verifying RED Template Helper Functions ---");

    // Test Split Logic which was duplicated
    const splitArtists = (artistString: string) => {
        return artistString.split(/,\s+|&|\s+\/\s+/).map((a: string) => a.trim()).filter((a: string) => a.length > 0);
    };

    console.log("--- Artist Split Check ---");
    const testStr = "Artist A, Artist B & Artist C";
    const res = splitArtists(testStr);
    console.log(`Input: "${testStr}"`);
    console.log(`Output: ${JSON.stringify(res)}`);
    if (res.length === 3 && res[1] === "Artist B") {
        console.log("PASS: Artist split logic works.");
    } else {
        console.log("FAIL: Artist split logic failed.");
    }

    console.log("\n--- RED Artist Logic Check ---");
    // Simulate the logic in route.ts
    const mainArtistName = "Artist A, Artist B";
    const allUniqueArtists = new Set(["Artist A", "Artist B", "Artist C"]);

    const mainArtistComponents = splitArtists(mainArtistName);
    const mainArtists = mainArtistComponents.map(name => ({ name }));
    const withArtists: { name: string }[] = [];

    allUniqueArtists.forEach(a => {
        if (!mainArtistComponents.includes(a) && a !== 'Various Artists') {
            withArtists.push({ name: a });
        }
    });

    console.log(`Main Artist Input: "${mainArtistName}"`);
    console.log(`Main Artists Output: ${JSON.stringify(mainArtists)}`);
    console.log(`With Artists Output: ${JSON.stringify(withArtists)}`);

    if (mainArtists.length === 2 && withArtists.length === 1 && withArtists[0].name === "Artist C") {
        console.log("PASS: RED Template artist logic correct.");
    } else {
        console.log("FAIL: RED Template artist logic incorrect.");
    }

    console.log("\n--- RED Label Logic Check ---");
    let label = "4059882 Records DK";
    label = label.replace(/(\(c\)|\u00A9|\u2117)?\s*\b(19|20)\d{2}\b\s*/gi, '').trim();
    console.log(`Label Input: "4059882 Records DK"`);
    console.log(`Label Output: "${label}"`);

    if (label === "4059882 Records DK") {
        console.log("PASS: Label preserved.");
    } else {
        console.log("FAIL: Label corrupted.");
    }
}

verifyRedFixes();
