from django.db import models


class Business(models.Model):
    name = models.CharField(max_length=255)
    logo = models.ImageField(upload_to='business/', blank=True, null=True)
    email = models.EmailField(blank=True)
    phone = models.CharField(max_length=20, blank=True)
    address = models.TextField(blank=True)
    currency = models.CharField(max_length=10, default='UGX')
    tax_pin = models.CharField(max_length=50, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)

    class Meta:
        verbose_name = 'Business Profile'

    def __str__(self):
        return self.name

    @classmethod
    def get(cls):
        """Always returns the single business instance."""
        return cls.objects.first()
