from django.apps import AppConfig
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import gettext_lazy as _


class DummyPluginAppConfig(AppConfig):
    name = 'getpaid.backends.dummy'
    label = 'getpaid_dummy'
    verbose_name = _('Dummy paywall')
    default_auto_field = 'django.db.models.AutoField'

    def ready(self):
        if not settings.DEBUG:
            raise ImproperlyConfigured('Do not use dummy plugin on production!')

        from getpaid.backends.dummy.processor import PaymentProcessor
        from getpaid.registry import registry

        registry.register(PaymentProcessor)
