<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23788.4" systemVersion="24G90" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithSwiftData="YES" userDefinedModelVersionIdentifier="">
    <entity name="CDProfile" representedClassName="CDProfile" codeGenerationType="class">
        <attribute name="accountUserId" optional="NO" attributeType="String" indexed="YES"/>
        <attribute name="bio" optional="YES" attributeType="String"/>
        <attribute name="createdAt" optional="YES" attributeType="Date"/>
        <attribute name="customName" optional="YES" attributeType="String"/>
        <attribute name="fullName" optional="YES" attributeType="String"/>
        <attribute name="isOfficial" optional="NO" attributeType="Boolean" defaultValueBoolean="NO" usesScalarValueType="YES"/>
        <attribute name="lastSeen" optional="YES" attributeType="Integer 64" usesScalarValueType="YES"/>
        <attribute name="login" optional="YES" attributeType="String"/>
        <attribute name="userId" optional="NO" attributeType="String" indexed="YES"/>
        <relationship name="chats" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="CDPrivateChat" inverseName="chatData" inverseEntity="CDPrivateChat"/>
        <relationship name="messages" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="CDMessage" inverseName="sender" inverseEntity="CDMessage"/>
        <fetchIndex name="idx_profile_account_user">
            <fetchIndexElement property="accountUserId" type="Binary"/>
            <fetchIndexElement property="userId" type="Binary"/>
        </fetchIndex>
        <fetchIndex name="idx_profile_userId">
            <fetchIndexElement property="userId" type="Binary"/>
        </fetchIndex>
    </entity>
    <entity name="CDPrivateChat" representedClassName="CDPrivateChat" codeGenerationType="class">
        <attribute name="accountUserId" optional="NO" attributeType="String" indexed="YES"/>
        <attribute name="chatId" optional="NO" attributeType="String" indexed="YES"/>
        <attribute name="chatType" optional="YES" attributeType="String"/>
        <attribute name="createdAt" optional="YES" attributeType="Date"/>
        <attribute name="unreadCount" optional="NO" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
        <relationship name="chatData" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CDProfile" inverseName="chats" inverseEntity="CDProfile"/>
        <relationship name="lastMessage" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CDMessage" inverseName="chatAsLastMessage" inverseEntity="CDMessage"/>
        <relationship name="messages" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="CDMessage" inverseName="chat" inverseEntity="CDMessage"/>
        <fetchIndex name="idx_chat_account_chatId">
            <fetchIndexElement property="accountUserId" type="Binary"/>
            <fetchIndexElement property="chatId" type="Binary"/>
        </fetchIndex>
        <fetchIndex name="idx_chat_chatId">
            <fetchIndexElement property="chatId" type="Binary"/>
        </fetchIndex>
    </entity>
    <entity name="CDMessage" representedClassName="CDMessage" codeGenerationType="class">
        <attribute name="accountUserId" optional="NO" attributeType="String" indexed="YES"/>
        <attribute name="chatId" optional="NO" attributeType="String" indexed="YES"/>
        <attribute name="content" optional="YES" attributeType="String"/>
        <attribute name="createdAt" optional="YES" attributeType="Date"/>
        <attribute name="forwardMessageId" optional="YES" attributeType="String"/>
        <attribute name="forwardSenderId" optional="YES" attributeType="String"/>
        <attribute name="forwardType" optional="YES" attributeType="String"/>
        <attribute name="isViewed" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
        <attribute name="mediaLink" optional="YES" attributeType="String"/>
        <attribute name="messageId" optional="NO" attributeType="String" indexed="YES"/>
        <attribute name="messageType" optional="YES" attributeType="String"/>
        <attribute name="senderId" optional="YES" attributeType="String"/>
        <attribute name="updatedAt" optional="YES" attributeType="Date"/>
        <relationship name="chat" optional="NO" maxCount="1" deletionRule="Nullify" destinationEntity="CDPrivateChat" inverseName="messages" inverseEntity="CDPrivateChat"/>
        <relationship name="chatAsLastMessage" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CDPrivateChat" inverseName="lastMessage" inverseEntity="CDPrivateChat"/>
        <relationship name="sender" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CDProfile" inverseName="messages" inverseEntity="CDProfile"/>
        <fetchIndex name="idx_message_account_chat_createdAt">
            <fetchIndexElement property="accountUserId" type="Binary"/>
            <fetchIndexElement property="chatId" type="Binary"/>
            <fetchIndexElement property="createdAt" type="Binary"/>
        </fetchIndex>
        <fetchIndex name="idx_message_messageId">
            <fetchIndexElement property="messageId" type="Binary"/>
        </fetchIndex>
    </entity>
    <elements>
        <element name="CDProfile" positionX="160" positionY="-128" width="128" height="151"/>
        <element name="CDPrivateChat" positionX="16" positionY="80" width="128" height="151"/>
        <element name="CDMessage" positionX="320" positionY="80" width="128" height="201"/>
    </elements>
</model>
