// // Models.swift // Poche // // Author: Simon-Pierre Boucher // Contact: contact@spboucher.ai // import Foundation import SwiftData // Everything lives locally, encrypted at rest via Data Protection // (CLAUDE.md §7). No field here ever leaves the device. /// Notes are internal to Poche (SwiftData). There is no public API for /// Apple Notes — the brief's `searchNotes`-against-Notes idea is not /// buildable (CLAUDE.md §4). @Model final class Note { var uuid: UUID var title: String var content: String var createdAt: Date var updatedAt: Date init(title: String, content: String) { self.uuid = UUID() self.title = title self.content = content self.createdAt = .now self.updatedAt = .now } } @Model final class TaskItem { var uuid: UUID var title: String var details: String? var dueDate: Date? var isDone: Bool var createdAt: Date var updatedAt: Date init(title: String, details: String? = nil, dueDate: Date? = nil) { self.uuid = UUID() self.title = title self.details = details self.dueDate = dueDate self.isDone = false self.createdAt = .now self.updatedAt = .now } } @Model final class ConversationRecord { var startedAt: Date var summary: String? @Relationship(deleteRule: .cascade, inverse: \TurnRecord.conversation) var turns: [TurnRecord] init() { self.startedAt = .now self.summary = nil self.turns = [] } } @Model final class TurnRecord { var date: Date var role: String var text: String var conversation: ConversationRecord? init(role: String, text: String) { self.date = .now self.role = role self.text = text } }