"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const client_1 = require("@prisma/client");
const prisma = new client_1.PrismaClient();
async function main() {
    const phone = process.env.SUPER_ADMIN_PHONE;
    const name = process.env.SUPER_ADMIN_NAME ?? 'Platform Super Admin';
    if (!phone) {
        throw new Error('SUPER_ADMIN_PHONE is required to create the production super admin account.');
    }
    const user = await prisma.user.upsert({
        where: { phone },
        update: {
            name,
            role: client_1.UserRole.SUPER_ADMIN,
            status: client_1.AccountStatus.ACTIVE,
            estateId: null
        },
        create: {
            estateId: null,
            phone,
            name,
            role: client_1.UserRole.SUPER_ADMIN,
            status: client_1.AccountStatus.ACTIVE
        }
    });
    console.log(`Super admin ready: ${user.phone} (${user.id})`);
}
main()
    .catch((error) => {
    console.error(error);
    process.exit(1);
})
    .finally(async () => {
    await prisma.$disconnect();
});
//# sourceMappingURL=seed-super-admin.js.map