package com.inkwell.volvox.data.local.entity import androidx.room.Entity import androidx.room.PrimaryKey import androidx.room.ForeignKey import androidx.room.Index /** * Volvox Trinity Graph - Local Room Schema * Maps the Social, Knowledge, and Generative dimensions directly to the mobile edge. */ @Entity( tableName = "trinity_nodes", indices = [Index(value = ["type"]), Index(value = ["label"])] ) data class NodeEntity( @PrimaryKey val id: String, // UUID val type: String, // "SOCIAL", "KNOWLEDGE", "GENERATIVE" val label: String, // e.g., "STUDENT", "CONCEPT", "DOCUMENT" val name: String, // e.g., "revilo", "Financial Toxicity" val payload: String, // JSON string of dynamic properties val confidenceScore: Float = 1.0f, // Epistemic certainty val timestamp: Long = System.currentTimeMillis() ) @Entity( tableName = "trinity_edges", foreignKeys = [ ForeignKey( entity = NodeEntity::class, parentColumns = ["id"], childColumns = ["sourceId"], onDelete = ForeignKey.CASCADE ), ForeignKey( entity = NodeEntity::class, parentColumns = ["id"], childColumns = ["targetId"], onDelete = ForeignKey.CASCADE ) ], indices = [Index(value = ["sourceId"]), Index(value = ["targetId"]), Index(value = ["relationship"])] ) data class EdgeEntity( @PrimaryKey val id: String, val sourceId: String, val targetId: String, val relationship: String, // e.g., "OWNS", "SHARES", "SUPERSEDES" val metadata: String? = null, // JSON string for edge weights/context val timestamp: Long = System.currentTimeMillis() )