const prisma = require('../../../src/prisma/PrismaClient.js');
const timeLocal = require('../../../src/utils/TimeLocal.js')

const cityNames = [
    'Kabupaten Fakfak',
    'Kabupaten Kaimana',
    'Kabupaten Manokwari',
    'Kabupaten Manokwari Selatan',
    'Kabupaten Pegunungan Arfak',
    'Kabupaten Teluk Bintuni',
    'Kabupaten Teluk Wondama',

    // 7
];

exports.seedPapuaBaratCities = async () => {
    const province = await prisma.province.findFirst({
        where: { name: 'Papua Barat' },
    });

    if (!province) {
        console.error('❌ Province Papua Barat not found. Seed it first.');
        return;
    }

    for (const name of cityNames) {
        await prisma.city.upsert({
            where: {
                name_province_id: {
                    name,
                    province_id: province.id,
                },
            },
            update: {
                updatedAt: timeLocal.now().toDate()
            },
            create: {
                name,
                province_id: province.id,
                createdAt: timeLocal.now().toDate()
            },
        });
    }

    console.log('✅ Papua Barat City seeded!.');
};