import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

async function main() {
    console.log('Verifying i18n migration...');

    const genre = await prisma.genre.findFirst();
    if (!genre) {
        console.log('No genres found to verify.');
        return;
    }

    console.log('First genre:', JSON.stringify(genre, null, 2));

    if (typeof genre.name === 'object' && genre.name !== null && 'de' in (genre.name as any)) {
        console.log('SUCCESS: Genre name is a JSON object with "de" key.');
    } else {
        console.error('FAILURE: Genre name is NOT in expected format:', genre.name);
        process.exit(1);
    }
}

main()
    .catch((e) => {
        console.error(e);
        process.exit(1);
    })
    .finally(async () => {
        await prisma.$disconnect();
    });
