"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapSettingsService = void 0;
const database_1 = require("../../../config/database");
exports.mapSettingsService = {
    async get() {
        let settings = await database_1.prisma.mapSettings.findFirst();
        if (!settings) {
            settings = await database_1.prisma.mapSettings.create({
                data: {
                    latitude: 45.4215,
                    longitude: -75.6972,
                    zoom: 12,
                },
            });
        }
        return settings;
    },
    async update(data) {
        const existing = await database_1.prisma.mapSettings.findFirst();
        if (existing) {
            return database_1.prisma.mapSettings.update({
                where: { id: existing.id },
                data,
            });
        }
        return database_1.prisma.mapSettings.create({
            data: {
                latitude: data.latitude ?? 45.4215,
                longitude: data.longitude ?? -75.6972,
                zoom: data.zoom ?? 12,
                ...data,
            },
        });
    },
};
//# sourceMappingURL=settings.service.js.map