import functools

from snek.model.channel import ChannelModel
from snek.model.channel_attachment import ChannelAttachmentModel
from snek.model.channel_member import ChannelMemberModel

# from snek.model.channel_message import ChannelMessageModel
from snek.model.channel_message import ChannelMessageModel
from snek.model.container import Container
from snek.model.drive import DriveModel
from snek.model.drive_item import DriveItemModel
from snek.model.notification import NotificationModel
from snek.model.push_registration import PushRegistrationModel
from snek.model.repository import RepositoryModel
from snek.model.user import UserModel
from snek.model.user_property import UserPropertyModel
from snek.system.object import Object


@functools.cache
def get_models():
    return Object(
        **{
            "user": UserModel,
            "channel_member": ChannelMemberModel,
            "channel": ChannelModel,
            "channel_message": ChannelMessageModel,
            "drive_item": DriveItemModel,
            "drive": DriveModel,
            "notification": NotificationModel,
            "user_property": UserPropertyModel,
            "repository": RepositoryModel,
            "channel_attachment": ChannelAttachmentModel,
            "container": Container,
            "push_registration": PushRegistrationModel,
        }
    )


def get_model(name):
    return get_models()[name]
