from django.db import models

class WebsiteSettings(models.Model):
    """Single model to store all website settings"""
    
    # General Settings
    company_name = models.CharField(max_length=200, default='CodeSofy Technologies')
    company_tagline = models.CharField(max_length=200, blank=True, default='Innovative Software Solutions')
    company_logo = models.ImageField(upload_to='settings/', blank=True, null=True)
    company_favicon = models.ImageField(upload_to='settings/', blank=True, null=True)
    
    # Contact Settings
    contact_email = models.EmailField(default='info@codesofy.com')
    contact_phone = models.CharField(max_length=50, default='+94 11 234 5678')
    contact_address = models.TextField(blank=True, default='Colombo, Sri Lanka')
    contact_map = models.URLField(blank=True, help_text='Google Maps embed URL')
    
    # Social Media
    facebook_url = models.URLField(blank=True)
    twitter_url = models.URLField(blank=True)
    linkedin_url = models.URLField(blank=True)
    instagram_url = models.URLField(blank=True)
    youtube_url = models.URLField(blank=True)
    
    # SEO Settings
    meta_title = models.CharField(max_length=200, blank=True, help_text='Default meta title for website')
    meta_description = models.TextField(blank=True, help_text='Default meta description for website')
    meta_keywords = models.CharField(max_length=500, blank=True, help_text='Comma separated keywords')
    
    # Footer Settings
    footer_copyright = models.CharField(max_length=200, blank=True, default='All rights reserved.')
    footer_logo = models.ImageField(upload_to='settings/', blank=True, null=True)
    
    # System
    updated_at = models.DateTimeField(auto_now=True)
    
    def __str__(self):
        return self.company_name
    
    class Meta:
        verbose_name_plural = "Website Settings"