from django.db import models
from model_utils.models import TimeStampedModel


class BaseModel(TimeStampedModel, models.Model):
    """
    An abstract base model that extends TimeStampedModel and SoftDeletableModel.

    Meta:
        abstract (bool): Indicates that this model is abstract and not intended to be used directly.
    """

    is_removed = models.BooleanField(default=False)

    class Meta:
        abstract = True

    def delete(self, using=None, soft=False, *args, **kwargs):
        """
        Soft delete object (set its ``is_removed`` field to True).
        Actually delete object if setting ``soft`` to False.
        """
        if soft:
            self.is_removed = True
            self.save(using=using)
        else:
            return super().delete(using=using, *args, **kwargs)
