from django.db import models


# Create your models here.
class Contact(models.Model):
    user = models.ForeignKey('accounts.CustomUser', on_delete=models.SET_NULL, null=True, blank=True, verbose_name="Kullanıcı")
    name = models.CharField(max_length=254, verbose_name="Ad Soyad ")
    email = models.CharField(max_length=254, verbose_name="Eposta Adresi ")
    ip = models.CharField(max_length=100, verbose_name="IP Adresi ", blank=True, null=True)
    subject = models.CharField(max_length=254, verbose_name="Konu ")
    message = models.TextField(verbose_name="Mesaj ")
    created_at = models.DateTimeField(auto_now_add=True, editable=False, verbose_name="Oluşturulma Tarihi")
    updated_at = models.DateTimeField(auto_now=True, editable=False, verbose_name="Güncelleme Tarihi")

    class Meta:
        ordering = ["created_at"]
        db_table = 'contacts'
        verbose_name_plural = "Contact"
        verbose_name = "Contact"

    def __str__(self):
        return f"Contact:  {self.name}"
