package eu.friedcutlet.yokan.database /** * Room-backed persistence. A pre-existing JSON snapshot is only consulted on * the cold path where Room is empty — passing a `() -> YokanDatabaseSnapshot?` * instead of a fully loaded one avoids paying the JSON read on every * subsequent boot. */ actual fun createDefaultDatabase(): YokanDatabase = createProfileDatabase(eu.friedcutlet.yokan.domain.ProfileId.Default) actual fun createProfileDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanDatabase = eu.friedcutlet.yokan.database.room.RoomYokanDatabase( room = eu.friedcutlet.yokan.database.room.createYokanRoomDatabase(profileId), legacySnapshotProvider = { if (profileId == eu.friedcutlet.yokan.domain.ProfileId.Default) createDefaultDatabaseSnapshotStore().load() else null }, )