/**
 * ConfigManager: Central configuration for multi-tenant hospital settings and white-labeling.
 */

class ConfigManager {
    constructor() {
        this.tenants = {
            'default': {
                name: "Curio Clinic",
                logo: "C",
                primaryColor: "#0F172A",
                secondaryColor: "#38BDF8",
                consultationFee: 500,
                currency: "₹",
                workingHours: [
                    { start: "09:00", end: "13:00" },
                    { start: "17:00", end: "22:00" }
                ],
                daysOff: [0], // 0 = Sunday
                holidays: ["2024-12-25", "2025-01-01"]
            },
            'sharma-clinic': {
                name: "Dr. Sharma's Cardiology",
                logo: "S",
                primaryColor: "#1E3A8A",
                secondaryColor: "#60A5FA",
                consultationFee: 800,
                currency: "₹",
                workingHours: [
                    { start: "10:00", end: "14:00" },
                    { start: "18:00", end: "21:00" }
                ],
                daysOff: [0, 6], // Sat, Sun
                holidays: []
            },
            'apollo-hospitals': {
                name: "Apollo Multispecialty",
                logo: "A",
                primaryColor: "#065F46",
                secondaryColor: "#34D399",
                consultationFee: 1200,
                currency: "₹",
                workingHours: [
                    { start: "09:00", end: "22:00" }
                ],
                daysOff: [],
                holidays: ["2024-10-02"]
            }
        };
    }

    getTenantConfig(tenantId) {
        return this.tenants[tenantId] || this.tenants['default'];
    }

    updateTenantConfig(tenantId, newConfig) {
        if (!this.tenants[tenantId]) {
            this.tenants[tenantId] = { ...this.tenants['default'] };
        }
        this.tenants[tenantId] = { ...this.tenants[tenantId], ...newConfig };
    }
}

module.exports = new ConfigManager();
