from django.db import models

# Create your models here.
class Preinfo(models.Model):
    container_number = models.CharField(
        max_length=11,
    )
    container_type = models.ForeignKey(
        'common.ContainerTypeModel',
        on_delete=models.CASCADE,
        related_name='preinfo_container_types',
    )
    line = models.ForeignKey(
        'common.LinesModel',
        on_delete=models.CASCADE,
        related_name='preinfo_lines',
    )
    created_on = models.DateTimeField(auto_now_add=True)
    created_by = models.ForeignKey(
        'accounts.DepotUser',
        on_delete=models.CASCADE,
        related_name='preinfo_created_by',
        db_column='created_by_id',  # Ensure the column name matches your database schema
    )
    deleted = models.BooleanField(default=False, null=False)
    deleted_by =  models.ForeignKey(
        'accounts.DepotUser',
        on_delete=models.CASCADE,
        related_name='preinfo_deleted_by',
        db_column='deleted_by_id',  # Ensure the column name matches your database schema
        null=True,
        blank=True
    )
    deleted_on = models.DateTimeField(null=True, blank=True)
    received = models.BooleanField(default=False, null=False)
