from django.conf import settings
from django.db import models

# from django.contrib.auth import get_user_model

# User = get_user_model()



class Category(models.Model):
    name = models.CharField(max_length=255, unique=True)
    image = models.ImageField(upload_to='category_images/', blank=True, null=True)  # Added image field

    def __str__(self):
        return self.name


class AdType(models.Model):
    name = models.CharField(max_length=255, unique=True)

    def __str__(self):
        return self.name


class AdTemplate(models.Model):
    name = models.CharField(max_length=255)
    description = models.TextField()
    price = models.DecimalField(max_digits=10, decimal_places=2)
    category = models.ForeignKey(Category, on_delete=models.CASCADE)
    ad_type = models.ForeignKey(AdType, on_delete=models.CASCADE)  # ✅ Ensure this field exists
    image = models.ImageField(upload_to='ad_templates/')

    def __str__(self):
        return self.name


