# Path: xmpp_backends/django/fake_xmpp/models.py
# class FakeUser(AbstractBaseUser):
#     username = models.CharField(max_length=64, unique=True)
#     email = models.EmailField(blank=True, null=True)
#     last_activity = models.DateTimeField(default=timezone.now)
#     last_status = models.CharField(max_length=255, blank=True, null=True)
#     is_blocked = models.BooleanField(default=True)
# 
#     USERNAME_FIELD = 'username'
# 
#     class Meta:
#         verbose_name = _('Fake XMPP User')
#         verbose_name_plural = _('Fake XMPP Users')
# 
#     @property
#     def node(self):
#         return self.username.split('@', 1)[0]
# 
#     @property
#     def domain(self):
#         return self.username.split('@', 1)[1]
# 
#     def message(self, subject, message, sender):
#         self.messages.create(subject=subject, message=message, sender=sender)
# 
# Path: xmpp_backends/django/fake_xmpp/models.py
# class FakeUserMessage(models.Model):
#     user = models.ForeignKey(FakeUser, models.CASCADE, related_name='messages')
#     sender = models.CharField(max_length=64)
#     date = models.DateTimeField(default=timezone.now)
#     subject = models.CharField(max_length=12)
#     message = models.CharField(max_length=128)
# 
# Path: xmpp_backends/django/fake_xmpp/models.py
# class FakeUserSession(models.Model):
#     user = models.ForeignKey(FakeUser, models.CASCADE, related_name='sessions')
#     resource = models.CharField(max_length=255, default=get_random_string)
#     priority = models.IntegerField(default=0)
#     ip_address = models.GenericIPAddressField(default='127.0.0.1')
#     uptime = models.DateTimeField(default=timezone.now)
#     status = models.CharField(max_length=255)
#     status_text = models.CharField(max_length=255)
#     connection_type = models.SmallIntegerField(choices=(
#         (CONNECTION_XMPP, _('XMPP')),
#         (CONNECTION_HTTP_POLLING, _('HTTP Polling')),
#         (CONNECTION_HTTP_BINDING, _('HTTP Binding')),
#         (CONNECTION_WEBSOCKETS, _('Websockets')),
#         (CONNECTION_UNKNOWN, _('Unkown')),
#     ))
#     encrypted = models.NullBooleanField()
#     compressed = models.NullBooleanField()
# 
#     class Meta:
#         verbose_name = _('Fake XMPP Session')
#         verbose_name_plural = _('Fake XMPP Sessions')


from django.contrib import admin
from .models import FakeUser
from .models import FakeUserMessage
from .models import FakeUserSession
# This file is part of xmpp-backends (https://github.com/mathiasertl/xmpp-backends).
#
# xmpp-backends is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# xmpp-backends is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with xmpp-backends. If
# not, see <http://www.gnu.org/licenses/>.




class SessionInline(admin.TabularInline):
    model = FakeUserSession


class MessageInline(admin.TabularInline):
    model = FakeUserMessage


@admin.register(FakeUser)
class FakeUserAdmin(admin.ModelAdmin):
    inlines = [MessageInline, SessionInline, ]

# Path: xmpp_backends/django/fake_xmpp/models.py
# class FakeUser(AbstractBaseUser):
#     username = models.CharField(max_length=64, unique=True)
#     email = models.EmailField(blank=True, null=True)
#     last_activity = models.DateTimeField(default=timezone.now)
#     last_status = models.CharField(max_length=255, blank=True, null=True)
#     is_blocked = models.BooleanField(default=True)
# 
#     USERNAME_FIELD = 'username'
# 
#     class Meta:
#         verbose_name = _('Fake XMPP User')
#         verbose_name_plural = _('Fake XMPP Users')
# 
#     @property
#     def node(self):
#         return self.username.split('@', 1)[0]
# 
#     @property
#     def domain(self):
#         return self.username.split('@', 1)[1]
# 
#     def message(self, subject, message, sender):
#         self.messages.create(subject=subject, message=message, sender=sender)
# 
# Path: xmpp_backends/django/fake_xmpp/models.py
# class FakeUserMessage(models.Model):
#     user = models.ForeignKey(FakeUser, models.CASCADE, related_name='messages')
#     sender = models.CharField(max_length=64)
#     date = models.DateTimeField(default=timezone.now)
#     subject = models.CharField(max_length=12)
#     message = models.CharField(max_length=128)
# 
# Path: xmpp_backends/django/fake_xmpp/models.py
# class FakeUserSession(models.Model):
#     user = models.ForeignKey(FakeUser, models.CASCADE, related_name='sessions')
#     resource = models.CharField(max_length=255, default=get_random_string)
#     priority = models.IntegerField(default=0)
#     ip_address = models.GenericIPAddressField(default='127.0.0.1')
#     uptime = models.DateTimeField(default=timezone.now)
#     status = models.CharField(max_length=255)
#     status_text = models.CharField(max_length=255)
#     connection_type = models.SmallIntegerField(choices=(
#         (CONNECTION_XMPP, _('XMPP')),
#         (CONNECTION_HTTP_POLLING, _('HTTP Polling')),
#         (CONNECTION_HTTP_BINDING, _('HTTP Binding')),
#         (CONNECTION_WEBSOCKETS, _('Websockets')),
#         (CONNECTION_UNKNOWN, _('Unkown')),
#     ))
#     encrypted = models.NullBooleanField()
#     compressed = models.NullBooleanField()
# 
#     class Meta:
#         verbose_name = _('Fake XMPP Session')
#         verbose_name_plural = _('Fake XMPP Sessions')


# Path: xmpp_backends/django/fake_xmpp/admin.py
from django.contrib import admin
from .models import FakeUser
from .models import FakeUserMessage
from .models import FakeUserSession

# This file is part of xmpp-backends (https://github.com/mathiasertl/xmpp-backends).
#
# xmpp-backends is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# xmpp-backends is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with xmpp-backends. If
# not, see <http://www.gnu.org/licenses/>.




class SessionInline(admin.TabularInline):
    model = FakeUserSession


class MessageInline(admin.TabularInline):
    model = FakeUserMessage


@admin.register(FakeUser)
class FakeUserAdmin(admin.ModelAdmin):
    inlines = [MessageInline, SessionInline, ]

    fields = ['username', 'email', 'password', ('last_login', 'last_activity'), 'last_status', 'is_blocked']