Files
hyungi_document_server/Sources/DSKit/Models/Catalog.swift
T
Hyungi 0becf7829e feat(s3): SwiftPM scaffold + DSKit data layer + 14-fixture acceptance
- Package.swift: AI (S2-owned) + DSKit (models/client/fixtures) + DSKitTests, tools 6.2, .swiftLanguageMode(.v6), .macOS(.v26)
- JSONValue (Sendable AnyCodable), DSDate (value-type ISO8601FormatStyle cascade, date-only UTC), explicit-CodingKeys decoder
- Models: Auth/Document(+Detail flat-compose, MD-first)/Catalog/Search+Ask/Memo/Digest; non-optional limited to id/file_type/created+updated_at/total
- DSClient protocol + FixtureDSClient (Bundle.module, zero backend) + DSError + DSConfig + DownloadURL (?token= query)
- Tests: 14-fixture contract acceptance (value asserts) + JSONValue number trap + Ask round-trip + AI router fallback/explicit-unavailable

swift build + swift test green (19 tests). Sources/AI untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 17:16:55 +09:00

55 lines
1.6 KiB
Swift

import Foundation
/// Recursive domain tree (documents_tree.json is a top-level ARRAY). `children` is optional so
/// SwiftUI OutlineGroup can treat leaves cleanly; `kids` is the non-optional accessor.
public struct DomainTreeNode: Codable, Sendable, Identifiable {
public let name: String
public let path: String
public let count: Int
public let children: [DomainTreeNode]?
public var id: String { path }
public var kids: [DomainTreeNode] { children ?? [] }
}
public struct CategoryCounts: Codable, Sendable {
public let total: Int
public let documents: Int
public let byDomain: [String: Int]
public let reviewPending: Int
public let pipelineFailed: Int
enum CodingKeys: String, CodingKey {
case total, documents
case byDomain = "by_domain"
case reviewPending = "review_pending"
case pipelineFailed = "pipeline_failed"
}
}
public struct DuplicateGroup: Codable, Sendable, Identifiable {
public let canonicalId: Int
public let members: [Int]
public let reason: String
public let detail: String?
public var id: Int { canonicalId }
enum CodingKeys: String, CodingKey {
case members, reason, detail
case canonicalId = "canonical_id"
}
}
public struct DuplicatesResponse: Codable, Sendable {
public let groups: [DuplicateGroup]
public let totalGroups: Int
public let totalDuplicateDocs: Int
enum CodingKeys: String, CodingKey {
case groups
case totalGroups = "total_groups"
case totalDuplicateDocs = "total_duplicate_docs"
}
}