from django.db import models

class GlobalSettings(models.Model):
    site_name = models.CharField(max_length=255, default='Lux Backend')
    contact_email = models.EmailField(max_length=255, blank=True)
    maintenance_mode = models.BooleanField(default=False)

    def save(self, *args, **kwargs):
        self.pk = 1
        super(GlobalSettings, self).save(*args, **kwargs)

    def delete(self, *args, **kwargs):
        pass

    @classmethod
    def load(cls):
        obj, created = cls.objects.get_or_create(pk=1)
        return obj

    def __str__(self):
        return self.site_name

class AdvancedSettings(models.Model):
    enable_analytics = models.BooleanField(default=False)
    analytics_id = models.CharField(max_length=255, blank=True)

    def save(self, *args, **kwargs):
        self.pk = 1
        super(AdvancedSettings, self).save(*args, **kwargs)

    def delete(self, *args, **kwargs):
        pass

    @classmethod
    def load(cls):
        obj, created = cls.objects.get_or_create(pk=1)
        return obj

    def __str__(self):
        return "Advanced Settings"
