from django.db import models
from pembayaran.models import Pembayaran
from pemeriksaan.models import Pendaftaran

# Create your models here.
class PromotionVoucher(models.Model):
    # Add other column
    kode = models.CharField(max_length=255, null=True, blank=True)
    diskon = models.CharField(max_length=255, null=True, blank=True)
    tipe_diskon = models.CharField(max_length=255, null=True, blank=True)
    min_pembayaran = models.CharField(max_length=255, null=True, blank=True)
    kuota = models.CharField(max_length=255, null=True, blank=True)
    kuota_terpakai = models.CharField(max_length=255, null=True, blank=True)
    is_active = models.CharField(max_length=255, null=True, blank=True)
    created_by = models.CharField(max_length=255, null=True, blank=True)
    expired_at = models.DateTimeField(auto_now_add=False)
    created_at = models.DateTimeField(auto_now_add=False)
    updated_at = models.DateTimeField(auto_now_add=False)

    class Meta:
        managed = False
        db_table = 'promotion_voucher'

class PromotionVoucherHistory(models.Model):
    # Add other column
    voucher = models.ForeignKey(PromotionVoucher, on_delete=models.SET_NULL, null=True, blank=True)
    pendaftaran = models.ForeignKey(Pendaftaran, on_delete=models.SET_NULL, null=True, blank=True)
    pembayaran = models.ForeignKey(Pembayaran, on_delete=models.SET_NULL, null=True, blank=True)
    status = models.CharField(max_length=255, null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=False)
    updated_at = models.DateTimeField(auto_now_add=False)

    class Meta:
        managed = False
        db_table = 'promotion_voucher_history'

class PromotionDiskon(models.Model):
    # Add other column
    kode = models.CharField(max_length=255, null=True, blank=True)
    diskon = models.CharField(max_length=255, null=True, blank=True)
    tipe_diskon = models.CharField(max_length=255, null=True, blank=True)
    min_qty = models.IntegerField()
    is_active = models.BooleanField(default=False)
    created_by = models.CharField(max_length=255, null=True, blank=True)
    start_at = models.DateField(auto_now_add=False)
    expired_at = models.DateField(auto_now_add=False)
    created_at = models.DateTimeField(auto_now_add=False)
    updated_at = models.DateTimeField(auto_now_add=False)

    class Meta:
        managed = False
        db_table = 'promotion_diskon'

class PromotionDiskonHistory(models.Model):
    # Add other column
    diskon = models.ForeignKey(PromotionDiskon, on_delete=models.SET_NULL, null=True, blank=True)
    layanan_diskon_id = models.CharField(max_length=255, null=True, blank=True)
    jenis_diskon = models.CharField(max_length=255, null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=False)

    class Meta:
        managed = False
        db_table = 'promotion_diskon_history'