// GENERATED by pnpm gen:swift-definitions. Never hand-edit. // Inputs: Rust serde types under cotton-core/src/definitions and cotton-rules/src/computed.rs; no product data. // Rust definition type fingerprint: 668aa7aa8f7af1cce6fd728fab23195022658dd5d406f31606f77a5756830377 import CottonPaper import CottonValues import Foundation /// Storage of cotton_core::definitions::RunningOpening (untagged: the first variant that reads). public enum DefinitionRunningOpening: Codable, Hashable, Sendable { case number(Decimal) case rollup(DefinitionRunningRollup) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(Decimal.self) { self = .number(value); return } self = .rollup(try c.decode(DefinitionRunningRollup.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .number(let value): try c.encode(value) case .rollup(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::SlipSubtitle (untagged: the first variant that reads). public enum DefinitionSlipSubtitle: Codable, Hashable, Sendable { case one(String) case several([String]) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(String.self) { self = .one(value); return } self = .several(try c.decode([String].self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .one(let value): try c.encode(value) case .several(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::SectionEmpty (untagged: the first variant that reads). public enum DefinitionSectionEmpty: Codable, Hashable, Sendable { case sentence(String) case titled(DefinitionSectionEmptyWords) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(String.self) { self = .sentence(value); return } self = .titled(try c.decode(DefinitionSectionEmptyWords.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .sentence(let value): try c.encode(value) case .titled(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::PageHand (untagged: the first variant that reads). public enum DefinitionPageHand: Codable, Hashable, Sendable { case columns([String]) case sentence(String) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode([String].self) { self = .columns(value); return } self = .sentence(try c.decode(String.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .columns(let value): try c.encode(value) case .sentence(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::SlipOpens (untagged: the first variant that reads). public enum DefinitionSlipOpens: Codable, Hashable, Sendable { case address(String) case record(DefinitionRecordOpens) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(String.self) { self = .address(value); return } self = .record(try c.decode(DefinitionRecordOpens.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .address(let value): try c.encode(value) case .record(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::MessageColumns (untagged: the first variant that reads). public enum DefinitionMessageColumns: Codable, Hashable, Sendable { case one(String) case several([String]) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(String.self) { self = .one(value); return } self = .several(try c.decode([String].self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .one(let value): try c.encode(value) case .several(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::CanSend (untagged: the first variant that reads). public enum DefinitionCanSend: Codable, Hashable, Sendable { case allowed(Bool) case column(String) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(Bool.self) { self = .allowed(value); return } self = .column(try c.decode(String.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .allowed(let value): try c.encode(value) case .column(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::ColumnReach (untagged: the first variant that reads). public enum DefinitionColumnReach: Codable, Hashable, Sendable { case word(DefinitionReachKind) case detailed(DefinitionReachDetail) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(DefinitionReachKind.self) { self = .word(value); return } self = .detailed(try c.decode(DefinitionReachDetail.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .word(let value): try c.encode(value) case .detailed(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::ToolPicture (untagged: the first variant that reads). public enum DefinitionToolPicture: Codable, Hashable, Sendable { case asset(String) case photo(DefinitionToolPhoto) case link(DefinitionLinkPicture) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(String.self) { self = .asset(value); return } if let value = try? c.decode(DefinitionToolPhoto.self) { self = .photo(value); return } self = .link(try c.decode(DefinitionLinkPicture.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .asset(let value): try c.encode(value) case .photo(let value): try c.encode(value) case .link(let value): try c.encode(value) } } } /// Storage of cotton_store::schema::package_tables::PackageIndex (untagged: the first variant that reads). public enum DefinitionPackageIndex: Codable, Hashable, Sendable { case legacy(String) case declared(DefinitionPackageIndexDeclared) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(String.self) { self = .legacy(value); return } self = .declared(try c.decode(DefinitionPackageIndexDeclared.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .legacy(let value): try c.encode(value) case .declared(let value): try c.encode(value) } } } /// Storage of cotton_store::schema::package_tables::PackageFullText (untagged: the first variant that reads). public enum DefinitionPackageFullText: Codable, Hashable, Sendable { case legacy(String) case declared(DefinitionPackageFullTextDeclared) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(String.self) { self = .legacy(value); return } self = .declared(try c.decode(DefinitionPackageFullTextDeclared.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .legacy(let value): try c.encode(value) case .declared(let value): try c.encode(value) } } } /// Storage of cotton_core::records::page::PageListAll (untagged: the first variant that reads). public enum DefinitionPageListAll: Codable, Hashable, Sendable { case table(DefinitionPageListAllTable) case read(DefinitionPageListAllRead) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(DefinitionPageListAllTable.self) { self = .table(value); return } self = .read(try c.decode(DefinitionPageListAllRead.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .table(let value): try c.encode(value) case .read(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::PageGroup (untagged: the first variant that reads). public enum DefinitionPageGroup: Codable, Hashable, Sendable { case columns(DefinitionGroupColumns) case reads(DefinitionGroupReads) case reach(DefinitionGroupReach) public init(from decoder: Decoder) throws { let c = try decoder.singleValueContainer() if let value = try? c.decode(DefinitionGroupColumns.self) { self = .columns(value); return } if let value = try? c.decode(DefinitionGroupReads.self) { self = .reads(value); return } self = .reach(try c.decode(DefinitionGroupReach.self)) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() switch self { case .columns(let value): try c.encode(value) case .reads(let value): try c.encode(value) case .reach(let value): try c.encode(value) } } } /// Storage of cotton_core::definitions::Computed (tagged: one key, the variant, holding its payload). public enum DefinitionComputed: Codable, Hashable, Sendable { case lookup(DefinitionLookup) case rollup(DefinitionRollup) case formula(DefinitionFormula) case running(DefinitionRunning) case previous(DefinitionPrevious) case activity(DefinitionActivity) public enum CodingKeys: String, CodingKey, CaseIterable { case lookup = "lookup" case rollup = "rollup" case formula = "formula" case running = "running" case previous = "previous" case activity = "activity" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) guard c.allKeys.count == 1, let key = c.allKeys.first else { throw DecodingError.dataCorrupted(.init(codingPath: decoder.codingPath, debugDescription: "Computed is exactly one of lookup, rollup, formula, running, previous, activity")) } switch key { case .lookup: self = .lookup(try c.decode(DefinitionLookup.self, forKey: .lookup)) case .rollup: self = .rollup(try c.decode(DefinitionRollup.self, forKey: .rollup)) case .formula: self = .formula(try c.decode(DefinitionFormula.self, forKey: .formula)) case .running: self = .running(try c.decode(DefinitionRunning.self, forKey: .running)) case .previous: self = .previous(try c.decode(DefinitionPrevious.self, forKey: .previous)) case .activity: self = .activity(try c.decode(DefinitionActivity.self, forKey: .activity)) } } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) switch self { case .lookup(let value): try c.encode(value, forKey: .lookup) case .rollup(let value): try c.encode(value, forKey: .rollup) case .formula(let value): try c.encode(value, forKey: .formula) case .running(let value): try c.encode(value, forKey: .running) case .previous(let value): try c.encode(value, forKey: .previous) case .activity(let value): try c.encode(value, forKey: .activity) } } } public enum DefinitionColumnType: String, Codable, Hashable, CaseIterable, Sendable { case text = "text" case accountNumber = "account_number" case longtext = "longtext" case date = "date" case time = "time" case number = "number" case bytes = "bytes" case amount = "amount" case choice = "choice" case link = "link" case photo = "photo" case file = "file" case bool = "bool" case url = "url" case place = "place" } public enum DefinitionPickSource: String, Codable, Hashable, CaseIterable, Sendable { case library = "library" case camera = "camera" } public enum DefinitionDeviceReads: String, Codable, Hashable, CaseIterable, Sendable { case appleHealth = "apple_health" } public enum DefinitionPictureKind: String, Codable, Hashable, CaseIterable, Sendable { case photo = "photo" case video = "video" } public enum DefinitionCommandKind: String, Codable, Hashable, CaseIterable, Sendable { case create = "create" case update = "update" case delete = "delete" case open = "open" case copy = "copy" case ask = "ask" } public enum DefinitionCommandDoes: String, Codable, Hashable, CaseIterable, Sendable { case completes = "completes" case times = "times" case moves = "moves" case destroys = "destroys" case putsAway = "puts-away" } public enum DefinitionViewFace: String, Codable, Hashable, CaseIterable, Sendable { case today = "today" case upcoming = "upcoming" case nextUp = "nextUp" case month = "month" case chats = "chats" case chart = "chart" } public enum DefinitionListLayout: String, Codable, Hashable, CaseIterable, Sendable { case cards = "cards" case sheet = "sheet" case list = "list" } public enum DefinitionSelectVerb: String, Codable, Hashable, CaseIterable, Sendable { case delete = "delete" } public enum DefinitionTableRole: String, Codable, Hashable, CaseIterable, Sendable { case todo = "todo" case event = "event" case note = "note" case person = "person" case project = "project" case thought = "thought" case tools = "tools" case database = "database" case copies = "copies" case members = "members" } public enum DefinitionTableScope: String, Codable, Hashable, CaseIterable, Sendable { case database = "database" case personal = "personal" } public enum DefinitionActionScheme: String, Codable, Hashable, CaseIterable, Sendable { case mailto = "mailto" case tel = "tel" case sms = "sms" case facetime = "facetime" case facetimeAudio = "facetime-audio" } public enum DefinitionAttachmentSource: String, Codable, Hashable, CaseIterable, Sendable { case library = "library" case camera = "camera" } public enum DefinitionSlipStock: String, Codable, Hashable, CaseIterable, Sendable { case plain = "plain" case rose = "rose" case sage = "sage" } public enum DefinitionSearchFace: String, Codable, Hashable, CaseIterable, Sendable { case field = "field" case icon = "icon" } public enum DefinitionSectionRole: String, Codable, Hashable, CaseIterable, Sendable { case main = "main" case facts = "facts" case side = "side" } public enum DefinitionSectionFace: String, Codable, Hashable, CaseIterable, Sendable { case slip = "slip" case page = "page" } public enum DefinitionInk: String, Codable, Hashable, CaseIterable, Sendable { case red = "red" case pencil = "pencil" } public enum DefinitionSlipEdge: String, Codable, Hashable, CaseIterable, Sendable { case receipt = "receipt" } public enum DefinitionTileFace: String, Codable, Hashable, CaseIterable, Sendable { case slipList = "slip-list" case polaroidGrid = "polaroid-grid" case capGrid = "cap-grid" case cardGrid = "card-grid" case month = "month" case sectionList = "section-list" case coverGrid = "cover-grid" case receipt = "receipt" case sparkline = "sparkline" case chart = "chart" } public enum DefinitionSummaryOp: String, Codable, Hashable, CaseIterable, Sendable { case count = "count" case sum = "sum" case min = "min" case max = "max" } public enum DefinitionChartKind: String, Codable, Hashable, CaseIterable, Sendable { case bar = "bar" case line = "line" } public enum DefinitionChartPeriod: String, Codable, Hashable, CaseIterable, Sendable { case month = "month" case week = "week" case day = "day" case hour = "hour" } public enum DefinitionChartSign: String, Codable, Hashable, CaseIterable, Sendable { case negative = "negative" case positive = "positive" } public enum DefinitionConversationFace: String, Codable, Hashable, CaseIterable, Sendable { case note = "note" case slip = "slip" } public enum DefinitionStackFace: String, Codable, Hashable, CaseIterable, Sendable { case polaroids = "polaroids" case slips = "slips" case covers = "covers" } public enum DefinitionPickKind: String, Codable, Hashable, CaseIterable, Sendable { case datetime = "datetime" case number = "number" case text = "text" case record = "record" case database = "database" case file = "file" } public enum DefinitionReachKind: String, Codable, Hashable, CaseIterable, Sendable { case phone = "phone" case email = "email" case instagram = "instagram" } public enum DefinitionLinkObject: String, Codable, Hashable, CaseIterable, Sendable { case cap = "cap" case people = "people" case picture = "picture" } public enum DefinitionColumnFormat: String, Codable, Hashable, CaseIterable, Sendable { case duration = "duration" case durationMs = "duration_ms" case words = "words" case repeatRule = "repeat-rule" case appName = "app-name" case bytes = "bytes" case dimensions = "dimensions" case ago = "ago" case calendarDatetime = "calendar-datetime" case countdown = "countdown" case countedPair = "counted-pair" } public enum DefinitionRollupOp: String, Codable, Hashable, CaseIterable, Sendable { case count = "count" case sum = "sum" case min = "min" case max = "max" case first = "first" case latest = "latest" case average = "average" } public enum DefinitionFormulaOp: String, Codable, Hashable, CaseIterable, Sendable { case sum = "sum" case difference = "difference" case sign = "sign" case signed = "signed" case join = "join" } public enum DefinitionActivityOp: String, Codable, Hashable, CaseIterable, Sendable { case latest = "latest" case count = "count" } public enum DefinitionListHead: String, Codable, Hashable, CaseIterable, Sendable { case nextAlarm = "next_alarm" } public enum DefinitionPagePart: String, Codable, Hashable, CaseIterable, Sendable { case title = "title" case facts = "facts" case grid = "grid" case content = "content" case messages = "messages" case script = "script" case sections = "sections" case strip = "strip" } public enum DefinitionPageShape: String, Codable, Hashable, CaseIterable, Sendable { case sheet = "sheet" case desk = "desk" } public enum DefinitionListFace: String, Codable, Hashable, CaseIterable, Sendable { case slips = "slips" case notes = "notes" case photos = "photos" } public enum DefinitionReadFormat: String, Codable, Hashable, CaseIterable, Sendable { case shortHash = "short_hash" case date = "date" } public enum DefinitionSlipWidth: String, Codable, Hashable, CaseIterable, Sendable { case half = "half" case full = "full" } public enum DefinitionToggleStyle: String, Codable, Hashable, CaseIterable, Sendable { case check = "check" case `switch` = "switch" } public enum DefinitionPageOpens: String, Codable, Hashable, CaseIterable, Sendable { case facts = "facts" case body = "body" case thing = "thing" } public enum DefinitionForm: String, Codable, Hashable, CaseIterable, Sendable { case relative = "relative" case weekdayDate = "weekday_date" case weekdayNameDate = "weekday_name_date" case weekdayDateYear = "weekday_date_year" case age = "age" case turns = "turns" case countdown = "countdown" case late = "late" case nextOccurrence = "next_occurrence" case since = "since" case money = "money" case moneySigned = "money_signed" case count = "count" case duration = "duration" case clock = "clock" case ago = "ago" case year = "year" case dayMonth = "day_month" case shortRef = "short_ref" } /// Storage of cotton_core::definitions::TableDefinition. struct DefinitionTableDefinition: Codable, Hashable, Sendable { var formatVersion: Int? = nil var tables: [DefinitionPackageTable]? = nil var retired: [DefinitionJSONValue]? = nil var id: String var name: String var plural: String var rowKey: String? = nil var faceChoices: Bool? = nil var visibility: String? = nil var picture: DefinitionToolPicture? = nil var shipped: Bool = false var engine: String? = nil var producer: DefinitionTableProducer? = nil var liveRead: LiveRecordRead? = nil var columns: [ColumnDefinition] var title: String = "" var voiceWords: [String]? = nil var date: String? = nil var project: String? = nil var order: String? = nil var reorder: Bool? = nil var slip: SlipLayout var tile: TileLayout var page: [PageSection] = [] var pageParts: [DefinitionPagePart]? = nil var archived: String? = nil var readonlyWhen: String? = nil var listedWhen: String? = nil var keptBy: KeptBy? = nil var add: Bool? = nil var sealed: Bool? = nil var seal: DefinitionJSONValue? = nil var send: DefinitionJSONValue? = nil var listHead: DefinitionListHead? = nil var scopeBy: String? = nil var binned: BinnedRows? = nil var stories: StoriesLayout? = nil var recordRoute: String? = nil var listRoute: String? = nil var scope: DefinitionTableScope? = nil var setup: Bool? = nil var linkedWhen: LinkedWhen? = nil var recordKind: String? = nil var pins: Bool? = nil var filingRank: Int? = nil var madeByVerb: Bool? = nil var role: DefinitionTableRole? = nil var takesFiles: Bool? = nil var screenFamily: String? = nil var polled: Bool? = nil var projectsRead: ProjectsRead? = nil var ownerSections: [PageSection]? = nil var archivedInCore: Bool? = nil var coreLinks: Bool? = nil var append: Bool? = nil var sort: ListSort? = nil var horizon: Int? = nil var group: ListGrouping? = nil var byDay: String? = nil var byMonth: String? = nil var dayGrouping: String? = nil var upcoming: ListUpcoming? = nil var recent: RecentLayout? = nil var dimmed: ValueMatch? = nil var layout: DefinitionListLayout = .list var grid: ListGrid? = nil var chips: ChipRow? = nil var paste: ListPaste? = nil var cover: CoverLayout? = nil var lists: [PageSection] = [] var opened: String? = nil var empty: EmptyWords? = nil var create: ListCreate? = nil var capture: ListCapture? = nil var exports: [RecordExport] = [] var pager: String? = nil var actions: [PageAction]? = nil var conversation: ConversationLayout? = nil var composer: Bool = false var index: String? = nil var search: [String] = [] var deletes: Bool = true var deleteWhen: SectionWhen? = nil var opens: RecordOpens? = nil var polaroid: PolaroidLayout? = nil var filter: ListFilter? = nil var countWords: CountWords? = nil var months: ListMonthsLayout? = nil var hidden: ValueMatch? = nil var shows: [String: RecordValue]? = nil var source: DefinitionJSONValue? = nil var select: ListSelect? = nil var deletion: DeletionWords? = nil var links: [ListLink] = [] var linkTiles: LinkTiles? = nil var menu: [MenuLine] = [] var searchPlaceholder: String? = nil var searchFace: DefinitionSearchFace? = nil var viewer: TableViewer? = nil var voice: VoiceWords? = nil var words: DefinitionTableWords? = nil var related: [RelatedRecords]? = nil var commands: [RecordCommand]? = nil var acts: [RecordCommand]? = nil var onOpen: String? = nil var handOver: RecordHandOver? = nil var attachments: AttachmentsLayout? = nil var clear: ListClear? = nil var live: LiveReading? = nil var derived: Bool? = nil var slipBy: SlipBy? = nil var instructions: String? = nil var prices: [String: DefinitionJSONValue]? = nil var contributions: Bool? = nil var groups: TableGroups? = nil var views: [DefinitionShippedView]? = nil var card: DefinitionCardFace? = nil var marks: [String: String]? = nil var tool: TableTool? = nil var heads: String? = nil var parts: DefinitionPageParts? = nil var slips: DefinitionSlipsLayout? = nil var edited: [String] = [] var baseHash: String? = nil var unknown: [String: DefinitionJSONValue] = [:] var fallbacks: [String] = [] var unavailable: [String] = [] init(_generated: Void, id: String, name: String, plural: String, columns: [ColumnDefinition], slip: SlipLayout, tile: TileLayout) { self.id = id self.name = name self.plural = plural self.columns = columns self.slip = slip self.tile = tile } enum CodingKeys: String, CodingKey, CaseIterable { case formatVersion = "format_version" case tables = "tables" case retired = "retired" case id = "id" case name = "name" case plural = "plural" case rowKey = "row_key" case faceChoices = "face_choices" case visibility = "visibility" case picture = "picture" case shipped = "builtin" case engine = "engine" case producer = "producer" case liveRead = "live_read" case columns = "columns" case title = "title" case voiceWords = "voice_words" case date = "date" case project = "project" case order = "order" case reorder = "reorder" case slip = "slip" case tile = "tile" case page = "page" case pageParts = "page_parts" case archived = "archived" case readonlyWhen = "readonly_when" case listedWhen = "listed_when" case keptBy = "kept_by" case add = "add" case sealed = "sealed" case seal = "seal" case send = "send" case listHead = "list_head" case scopeBy = "scope_by" case binned = "binned" case stories = "stories" case recordRoute = "record_route" case listRoute = "list_route" case scope = "scope" case setup = "setup" case linkedWhen = "linked_when" case recordKind = "record_kind" case pins = "pins" case filingRank = "filing_rank" case madeByVerb = "made_by_verb" case role = "role" case takesFiles = "takes_files" case screenFamily = "screen_family" case polled = "polled" case projectsRead = "projects_read" case ownerSections = "owner_sections" case archivedInCore = "archived_in_core" case coreLinks = "core_links" case append = "append" case sort = "sort" case horizon = "horizon" case group = "group" case byDay = "by_day" case byMonth = "by_month" case dayGrouping = "day_grouping" case upcoming = "upcoming" case recent = "recent" case dimmed = "dimmed" case layout = "layout" case grid = "grid" case chips = "chips" case paste = "paste" case cover = "cover" case lists = "lists" case opened = "opened" case empty = "empty" case create = "create" case capture = "capture" case exports = "exports" case pager = "pager" case actions = "actions" case conversation = "conversation" case composer = "composer" case index = "index" case search = "search" case deletes = "delete" case deleteWhen = "delete_when" case opens = "opens" case polaroid = "polaroid" case filter = "filter" case countWords = "count_words" case months = "months" case hidden = "hidden" case shows = "shows" case source = "source" case select = "select" case deletion = "deletion" case links = "links" case linkTiles = "link_tiles" case menu = "menu" case searchPlaceholder = "search_placeholder" case searchFace = "search_face" case viewer = "viewer" case voice = "voice" case words = "words" case related = "related" case commands = "commands" case acts = "acts" case onOpen = "on_open" case handOver = "hand_over" case attachments = "attachments" case clear = "clear" case live = "live" case derived = "derived" case slipBy = "slip_by" case instructions = "instructions" case prices = "prices" case contributions = "contributions" case groups = "groups" case views = "views" case card = "card" case marks = "marks" case tool = "tool" case heads = "heads" case parts = "parts" case slips = "slips" case edited = "edited" case baseHash = "base_hash" case fallbacks = "fallbacks" case unavailable = "unavailable" } init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) formatVersion = try c.decodeIfPresent(Int.self, forKey: .formatVersion) tables = try c.decodeIfPresent([DefinitionPackageTable].self, forKey: .tables) retired = try c.decodeIfPresent([DefinitionJSONValue].self, forKey: .retired) id = try c.decode(String.self, forKey: .id) name = try c.decode(String.self, forKey: .name) plural = try c.decode(String.self, forKey: .plural) rowKey = try c.decodeIfPresent(String.self, forKey: .rowKey) faceChoices = try c.decodeIfPresent(Bool.self, forKey: .faceChoices) visibility = try c.decodeIfPresent(String.self, forKey: .visibility) picture = try c.decodeIfPresent(DefinitionToolPicture.self, forKey: .picture) shipped = try c.decodeIfPresent(Bool.self, forKey: .shipped) ?? false engine = try c.decodeIfPresent(String.self, forKey: .engine) producer = try c.decodeIfPresent(DefinitionTableProducer.self, forKey: .producer) liveRead = try c.decodeIfPresent(LiveRecordRead.self, forKey: .liveRead) columns = try c.decode([ColumnDefinition].self, forKey: .columns) title = try c.decodeIfPresent(String.self, forKey: .title) ?? "" voiceWords = try c.decodeIfPresent([String].self, forKey: .voiceWords) date = try c.decodeIfPresent(String.self, forKey: .date) project = try c.decodeIfPresent(String.self, forKey: .project) order = try c.decodeIfPresent(String.self, forKey: .order) reorder = try c.decodeIfPresent(Bool.self, forKey: .reorder) slip = try c.decode(SlipLayout.self, forKey: .slip) tile = try c.decode(TileLayout.self, forKey: .tile) page = try c.decodeIfPresent([PageSection].self, forKey: .page) ?? [] pageParts = try c.decodeIfPresent([DefinitionPagePart].self, forKey: .pageParts) archived = try c.decodeIfPresent(String.self, forKey: .archived) readonlyWhen = try c.decodeIfPresent(String.self, forKey: .readonlyWhen) listedWhen = try c.decodeIfPresent(String.self, forKey: .listedWhen) keptBy = try c.decodeIfPresent(KeptBy.self, forKey: .keptBy) add = try c.decodeIfPresent(Bool.self, forKey: .add) sealed = try c.decodeIfPresent(Bool.self, forKey: .sealed) seal = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .seal) send = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .send) listHead = try c.decodeIfPresent(DefinitionListHead.self, forKey: .listHead) scopeBy = try c.decodeIfPresent(String.self, forKey: .scopeBy) binned = try c.decodeIfPresent(BinnedRows.self, forKey: .binned) stories = try c.decodeIfPresent(StoriesLayout.self, forKey: .stories) recordRoute = try c.decodeIfPresent(String.self, forKey: .recordRoute) listRoute = try c.decodeIfPresent(String.self, forKey: .listRoute) scope = try c.decodeIfPresent(DefinitionTableScope.self, forKey: .scope) setup = try c.decodeIfPresent(Bool.self, forKey: .setup) linkedWhen = try c.decodeIfPresent(LinkedWhen.self, forKey: .linkedWhen) recordKind = try c.decodeIfPresent(String.self, forKey: .recordKind) pins = try c.decodeIfPresent(Bool.self, forKey: .pins) filingRank = try c.decodeIfPresent(Int.self, forKey: .filingRank) madeByVerb = try c.decodeIfPresent(Bool.self, forKey: .madeByVerb) role = try c.decodeIfPresent(DefinitionTableRole.self, forKey: .role) takesFiles = try c.decodeIfPresent(Bool.self, forKey: .takesFiles) screenFamily = try c.decodeIfPresent(String.self, forKey: .screenFamily) polled = try c.decodeIfPresent(Bool.self, forKey: .polled) projectsRead = try c.decodeIfPresent(ProjectsRead.self, forKey: .projectsRead) ownerSections = try c.decodeIfPresent([PageSection].self, forKey: .ownerSections) archivedInCore = try c.decodeIfPresent(Bool.self, forKey: .archivedInCore) coreLinks = try c.decodeIfPresent(Bool.self, forKey: .coreLinks) append = try c.decodeIfPresent(Bool.self, forKey: .append) sort = try c.decodeIfPresent(ListSort.self, forKey: .sort) horizon = try c.decodeIfPresent(Int.self, forKey: .horizon) group = try c.decodeIfPresent(ListGrouping.self, forKey: .group) byDay = try c.decodeIfPresent(String.self, forKey: .byDay) byMonth = try c.decodeIfPresent(String.self, forKey: .byMonth) dayGrouping = try c.decodeIfPresent(String.self, forKey: .dayGrouping) upcoming = try c.decodeIfPresent(ListUpcoming.self, forKey: .upcoming) recent = try c.decodeIfPresent(RecentLayout.self, forKey: .recent) dimmed = try c.decodeIfPresent(ValueMatch.self, forKey: .dimmed) layout = try c.decodeIfPresent(DefinitionListLayout.self, forKey: .layout) ?? .list grid = try c.decodeIfPresent(ListGrid.self, forKey: .grid) chips = try c.decodeIfPresent(ChipRow.self, forKey: .chips) paste = try c.decodeIfPresent(ListPaste.self, forKey: .paste) cover = try c.decodeIfPresent(CoverLayout.self, forKey: .cover) lists = try c.decodeIfPresent([PageSection].self, forKey: .lists) ?? [] opened = try c.decodeIfPresent(String.self, forKey: .opened) empty = try c.decodeIfPresent(EmptyWords.self, forKey: .empty) create = try c.decodeIfPresent(ListCreate.self, forKey: .create) capture = try c.decodeIfPresent(ListCapture.self, forKey: .capture) exports = try c.decodeIfPresent([RecordExport].self, forKey: .exports) ?? [] pager = try c.decodeIfPresent(String.self, forKey: .pager) actions = try c.decodeIfPresent([PageAction].self, forKey: .actions) conversation = try c.decodeIfPresent(ConversationLayout.self, forKey: .conversation) composer = try c.decodeIfPresent(Bool.self, forKey: .composer) ?? false index = try c.decodeIfPresent(String.self, forKey: .index) search = try c.decodeIfPresent([String].self, forKey: .search) ?? [] deletes = try c.decodeIfPresent(Bool.self, forKey: .deletes) ?? true deleteWhen = try c.decodeIfPresent(SectionWhen.self, forKey: .deleteWhen) opens = try c.decodeIfPresent(RecordOpens.self, forKey: .opens) polaroid = try c.decodeIfPresent(PolaroidLayout.self, forKey: .polaroid) filter = try c.decodeIfPresent(ListFilter.self, forKey: .filter) countWords = try c.decodeIfPresent(CountWords.self, forKey: .countWords) months = try c.decodeIfPresent(ListMonthsLayout.self, forKey: .months) hidden = try c.decodeIfPresent(ValueMatch.self, forKey: .hidden) shows = try c.decodeIfPresent([String: RecordValue].self, forKey: .shows) source = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .source) select = try c.decodeIfPresent(ListSelect.self, forKey: .select) deletion = try c.decodeIfPresent(DeletionWords.self, forKey: .deletion) links = try c.decodeIfPresent([ListLink].self, forKey: .links) ?? [] linkTiles = try c.decodeIfPresent(LinkTiles.self, forKey: .linkTiles) menu = try c.decodeIfPresent([MenuLine].self, forKey: .menu) ?? [] searchPlaceholder = try c.decodeIfPresent(String.self, forKey: .searchPlaceholder) searchFace = try c.decodeIfPresent(DefinitionSearchFace.self, forKey: .searchFace) viewer = try c.decodeIfPresent(TableViewer.self, forKey: .viewer) voice = try c.decodeIfPresent(VoiceWords.self, forKey: .voice) words = try c.decodeIfPresent(DefinitionTableWords.self, forKey: .words) related = try c.decodeIfPresent([RelatedRecords].self, forKey: .related) commands = try c.decodeIfPresent([RecordCommand].self, forKey: .commands) acts = try c.decodeIfPresent([RecordCommand].self, forKey: .acts) onOpen = try c.decodeIfPresent(String.self, forKey: .onOpen) handOver = try c.decodeIfPresent(RecordHandOver.self, forKey: .handOver) attachments = try c.decodeIfPresent(AttachmentsLayout.self, forKey: .attachments) clear = try c.decodeIfPresent(ListClear.self, forKey: .clear) live = try c.decodeIfPresent(LiveReading.self, forKey: .live) derived = try c.decodeIfPresent(Bool.self, forKey: .derived) slipBy = try c.decodeIfPresent(SlipBy.self, forKey: .slipBy) instructions = try c.decodeIfPresent(String.self, forKey: .instructions) prices = try c.decodeIfPresent([String: DefinitionJSONValue].self, forKey: .prices) contributions = try c.decodeIfPresent(Bool.self, forKey: .contributions) groups = try c.decodeIfPresent(TableGroups.self, forKey: .groups) views = try c.decodeIfPresent([DefinitionShippedView].self, forKey: .views) card = try c.decodeIfPresent(DefinitionCardFace.self, forKey: .card) marks = try c.decodeIfPresent([String: String].self, forKey: .marks) tool = try c.decodeIfPresent(TableTool.self, forKey: .tool) heads = try c.decodeIfPresent(String.self, forKey: .heads) parts = try c.decodeIfPresent(DefinitionPageParts.self, forKey: .parts) slips = try c.decodeIfPresent(DefinitionSlipsLayout.self, forKey: .slips) edited = try c.decodeIfPresent([String].self, forKey: .edited) ?? [] baseHash = try c.decodeIfPresent(String.self, forKey: .baseHash) fallbacks = try c.decodeIfPresent([String].self, forKey: .fallbacks) ?? [] unavailable = try c.decodeIfPresent([String].self, forKey: .unavailable) ?? [] let all = try decoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for key in all.allKeys where !known.contains(key.stringValue) { unknown[key.stringValue] = try all.decode(DefinitionJSONValue.self, forKey: key) } } func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(formatVersion, forKey: .formatVersion) try c.encodeIfPresent(tables, forKey: .tables) try c.encodeIfPresent(retired, forKey: .retired) try c.encode(id, forKey: .id) try c.encode(name, forKey: .name) try c.encode(plural, forKey: .plural) try c.encodeIfPresent(rowKey, forKey: .rowKey) try c.encodeIfPresent(faceChoices, forKey: .faceChoices) try c.encodeIfPresent(visibility, forKey: .visibility) try c.encodeIfPresent(picture, forKey: .picture) try c.encode(shipped, forKey: .shipped) try c.encodeIfPresent(engine, forKey: .engine) try c.encodeIfPresent(producer, forKey: .producer) try c.encodeIfPresent(liveRead, forKey: .liveRead) try c.encode(columns, forKey: .columns) try c.encode(title, forKey: .title) try c.encodeIfPresent(voiceWords, forKey: .voiceWords) try c.encodeIfPresent(date, forKey: .date) try c.encodeIfPresent(project, forKey: .project) try c.encodeIfPresent(order, forKey: .order) try c.encodeIfPresent(reorder, forKey: .reorder) try c.encode(slip, forKey: .slip) try c.encode(tile, forKey: .tile) try c.encode(page, forKey: .page) try c.encodeIfPresent(pageParts, forKey: .pageParts) try c.encodeIfPresent(archived, forKey: .archived) try c.encodeIfPresent(readonlyWhen, forKey: .readonlyWhen) try c.encodeIfPresent(listedWhen, forKey: .listedWhen) try c.encodeIfPresent(keptBy, forKey: .keptBy) try c.encodeIfPresent(add, forKey: .add) try c.encodeIfPresent(sealed, forKey: .sealed) try c.encodeIfPresent(seal, forKey: .seal) try c.encodeIfPresent(send, forKey: .send) try c.encodeIfPresent(listHead, forKey: .listHead) try c.encodeIfPresent(scopeBy, forKey: .scopeBy) try c.encodeIfPresent(binned, forKey: .binned) try c.encodeIfPresent(stories, forKey: .stories) try c.encodeIfPresent(recordRoute, forKey: .recordRoute) try c.encodeIfPresent(listRoute, forKey: .listRoute) try c.encodeIfPresent(scope, forKey: .scope) try c.encodeIfPresent(setup, forKey: .setup) try c.encodeIfPresent(linkedWhen, forKey: .linkedWhen) try c.encodeIfPresent(recordKind, forKey: .recordKind) try c.encodeIfPresent(pins, forKey: .pins) try c.encodeIfPresent(filingRank, forKey: .filingRank) try c.encodeIfPresent(madeByVerb, forKey: .madeByVerb) try c.encodeIfPresent(role, forKey: .role) try c.encodeIfPresent(takesFiles, forKey: .takesFiles) try c.encodeIfPresent(screenFamily, forKey: .screenFamily) try c.encodeIfPresent(polled, forKey: .polled) try c.encodeIfPresent(projectsRead, forKey: .projectsRead) try c.encodeIfPresent(ownerSections, forKey: .ownerSections) try c.encodeIfPresent(archivedInCore, forKey: .archivedInCore) try c.encodeIfPresent(coreLinks, forKey: .coreLinks) try c.encodeIfPresent(append, forKey: .append) try c.encodeIfPresent(sort, forKey: .sort) try c.encodeIfPresent(horizon, forKey: .horizon) try c.encodeIfPresent(group, forKey: .group) try c.encodeIfPresent(byDay, forKey: .byDay) try c.encodeIfPresent(byMonth, forKey: .byMonth) try c.encodeIfPresent(dayGrouping, forKey: .dayGrouping) try c.encodeIfPresent(upcoming, forKey: .upcoming) try c.encodeIfPresent(recent, forKey: .recent) try c.encodeIfPresent(dimmed, forKey: .dimmed) if layout != .list { try c.encode(layout, forKey: .layout) } try c.encodeIfPresent(grid, forKey: .grid) try c.encodeIfPresent(chips, forKey: .chips) try c.encodeIfPresent(paste, forKey: .paste) try c.encodeIfPresent(cover, forKey: .cover) if !lists.isEmpty { try c.encode(lists, forKey: .lists) } try c.encodeIfPresent(opened, forKey: .opened) try c.encodeIfPresent(empty, forKey: .empty) try c.encodeIfPresent(create, forKey: .create) try c.encodeIfPresent(capture, forKey: .capture) if !exports.isEmpty { try c.encode(exports, forKey: .exports) } try c.encodeIfPresent(pager, forKey: .pager) try c.encodeIfPresent(actions, forKey: .actions) try c.encodeIfPresent(conversation, forKey: .conversation) if composer { try c.encode(composer, forKey: .composer) } try c.encodeIfPresent(index, forKey: .index) if !search.isEmpty { try c.encode(search, forKey: .search) } if deletes != true { try c.encode(deletes, forKey: .deletes) } try c.encodeIfPresent(deleteWhen, forKey: .deleteWhen) try c.encodeIfPresent(opens, forKey: .opens) try c.encodeIfPresent(polaroid, forKey: .polaroid) try c.encodeIfPresent(filter, forKey: .filter) try c.encodeIfPresent(countWords, forKey: .countWords) try c.encodeIfPresent(months, forKey: .months) try c.encodeIfPresent(hidden, forKey: .hidden) try c.encodeIfPresent(shows, forKey: .shows) try c.encodeIfPresent(source, forKey: .source) try c.encodeIfPresent(select, forKey: .select) try c.encodeIfPresent(deletion, forKey: .deletion) if !links.isEmpty { try c.encode(links, forKey: .links) } try c.encodeIfPresent(linkTiles, forKey: .linkTiles) if !menu.isEmpty { try c.encode(menu, forKey: .menu) } try c.encodeIfPresent(searchPlaceholder, forKey: .searchPlaceholder) try c.encodeIfPresent(searchFace, forKey: .searchFace) try c.encodeIfPresent(viewer, forKey: .viewer) try c.encodeIfPresent(voice, forKey: .voice) try c.encodeIfPresent(words, forKey: .words) try c.encodeIfPresent(related, forKey: .related) try c.encodeIfPresent(commands, forKey: .commands) try c.encodeIfPresent(acts, forKey: .acts) try c.encodeIfPresent(onOpen, forKey: .onOpen) try c.encodeIfPresent(handOver, forKey: .handOver) try c.encodeIfPresent(attachments, forKey: .attachments) try c.encodeIfPresent(clear, forKey: .clear) try c.encodeIfPresent(live, forKey: .live) try c.encodeIfPresent(derived, forKey: .derived) try c.encodeIfPresent(slipBy, forKey: .slipBy) try c.encodeIfPresent(instructions, forKey: .instructions) try c.encodeIfPresent(prices, forKey: .prices) try c.encodeIfPresent(contributions, forKey: .contributions) try c.encodeIfPresent(groups, forKey: .groups) try c.encodeIfPresent(views, forKey: .views) try c.encodeIfPresent(card, forKey: .card) try c.encodeIfPresent(marks, forKey: .marks) try c.encodeIfPresent(tool, forKey: .tool) try c.encodeIfPresent(heads, forKey: .heads) try c.encodeIfPresent(parts, forKey: .parts) try c.encodeIfPresent(slips, forKey: .slips) if !edited.isEmpty { try c.encode(edited, forKey: .edited) } try c.encodeIfPresent(baseHash, forKey: .baseHash) if !fallbacks.isEmpty { try c.encode(fallbacks, forKey: .fallbacks) } if !unavailable.isEmpty { try c.encode(unavailable, forKey: .unavailable) } var all = encoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for (key, value) in unknown where !known.contains(key) { try all.encode(value, forKey: DefinitionCodingKey(key)) } } } /// Storage of cotton_core::definitions::TableProducer. public struct DefinitionTableProducer: Codable, Hashable, Sendable { public var tokenId: String public init(_generated: Void, tokenId: String) { self.tokenId = tokenId } public enum CodingKeys: String, CodingKey, CaseIterable { case tokenId = "token_id" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) tokenId = try c.decode(String.self, forKey: .tokenId) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(tokenId, forKey: .tokenId) } } /// Storage of cotton_core::definitions::Column. struct DefinitionColumn: Codable, Hashable, Sendable { var key: String var name: String? = nil var `type`: DefinitionColumnType var counter: Bool? = nil var place: DefinitionPlaceColumns? = nil var required: Bool = false var linkTo: String? = nil var choices: [String]? = nil var indexed: Bool = false var readonly: Bool = false var live: Bool? = nil var fact: Bool? = nil var reading: String? = nil var decimals: Int? = nil var factJoin: String? = nil var toggleOn: [String]? = nil var editableWhen: ShownWhen? = nil var placeholder: String? = nil var pastName: String? = nil var pair: String? = nil var units: ColumnUnits? = nil var format: DefinitionColumnFormat? = nil var stamps: [String: String]? = nil var moves: [String: [String]]? = nil var hints: [String: String]? = nil var objects: [String: String]? = nil var multiple: Bool = false var week: Bool = false var month: Bool = false var shownWhen: ShownWhen? = nil var secret: Bool? = nil var redWhen: [String]? = nil var presentation: String? = nil var choicesFrom: String? = nil var labels: [String: String]? = nil var choiceNames: [String: String]? = nil var until: String? = nil var size: [String]? = nil var caption: String? = nil var captionFallback: String? = nil var plainBefore: String? = nil var plainAfter: String? = nil var opens: RecordOpens? = nil var poster: String? = nil var zone: Bool = false var untimed: String? = nil var yearly: Bool = false var reach: DefinitionColumnReach? = nil var provenance: ColumnProvenance? = nil var signs: AmountSigns? = nil var currency: String? = nil var signed: Bool? = nil var linkBy: DefinitionJSONValue? = nil var reveal: ColumnReveal? = nil var tones: DefinitionJSONValue? = nil var markdown: Bool? = nil var defaultValue: RecordValue? = nil var computed: DefinitionComputed? = nil var contributes: DefinitionJSONValue? = nil var hidden: Bool? = nil var edges: Bool? = nil var media: Bool? = nil var families: [String: String]? = nil var examples: [String: [String]]? = nil var says: [String]? = nil init(_generated: Void, key: String, `type`: DefinitionColumnType) { self.key = key self.`type` = `type` } enum CodingKeys: String, CodingKey, CaseIterable { case key = "key" case name = "name" case `type` = "type" case counter = "counter" case place = "place" case required = "required" case linkTo = "link_to" case choices = "choices" case indexed = "indexed" case readonly = "readonly" case live = "live" case fact = "fact" case reading = "reading" case decimals = "decimals" case factJoin = "fact_join" case toggleOn = "toggle_on" case editableWhen = "editable_when" case placeholder = "placeholder" case pastName = "past_name" case pair = "pair" case units = "units" case format = "format" case stamps = "stamps" case moves = "moves" case hints = "hints" case objects = "objects" case multiple = "multiple" case week = "week" case month = "month" case shownWhen = "shown_when" case secret = "secret" case redWhen = "red_when" case presentation = "presentation" case choicesFrom = "choices_from" case labels = "labels" case choiceNames = "choice_names" case until = "until" case size = "size" case caption = "caption" case captionFallback = "caption_fallback" case plainBefore = "plain_before" case plainAfter = "plain_after" case opens = "opens" case poster = "poster" case zone = "zone" case untimed = "untimed" case yearly = "yearly" case reach = "reach" case provenance = "provenance" case signs = "signs" case currency = "currency" case signed = "signed" case linkBy = "link_by" case reveal = "reveal" case tones = "tones" case markdown = "markdown" case defaultValue = "default" case computed = "computed" case contributes = "contributes" case hidden = "hidden" case edges = "edges" case media = "media" case families = "families" case examples = "examples" case says = "says" } init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) key = try c.decode(String.self, forKey: .key) name = try c.decodeIfPresent(String.self, forKey: .name) `type` = try c.decode(DefinitionColumnType.self, forKey: .`type`) counter = try c.decodeIfPresent(Bool.self, forKey: .counter) place = try c.decodeIfPresent(DefinitionPlaceColumns.self, forKey: .place) required = try c.decodeIfPresent(Bool.self, forKey: .required) ?? false linkTo = try c.decodeIfPresent(String.self, forKey: .linkTo) choices = try c.decodeIfPresent([String].self, forKey: .choices) indexed = try c.decodeIfPresent(Bool.self, forKey: .indexed) ?? false readonly = try c.decodeIfPresent(Bool.self, forKey: .readonly) ?? false live = try c.decodeIfPresent(Bool.self, forKey: .live) fact = try c.decodeIfPresent(Bool.self, forKey: .fact) reading = try c.decodeIfPresent(String.self, forKey: .reading) decimals = try c.decodeIfPresent(Int.self, forKey: .decimals) factJoin = try c.decodeIfPresent(String.self, forKey: .factJoin) toggleOn = try c.decodeIfPresent([String].self, forKey: .toggleOn) editableWhen = try c.decodeIfPresent(ShownWhen.self, forKey: .editableWhen) placeholder = try c.decodeIfPresent(String.self, forKey: .placeholder) pastName = try c.decodeIfPresent(String.self, forKey: .pastName) pair = try c.decodeIfPresent(String.self, forKey: .pair) units = try c.decodeIfPresent(ColumnUnits.self, forKey: .units) format = try? c.decodeIfPresent(DefinitionColumnFormat.self, forKey: .format) stamps = try c.decodeIfPresent([String: String].self, forKey: .stamps) moves = try c.decodeIfPresent([String: [String]].self, forKey: .moves) hints = try c.decodeIfPresent([String: String].self, forKey: .hints) objects = try c.decodeIfPresent([String: String].self, forKey: .objects) multiple = try c.decodeIfPresent(Bool.self, forKey: .multiple) ?? false week = try c.decodeIfPresent(Bool.self, forKey: .week) ?? false month = try c.decodeIfPresent(Bool.self, forKey: .month) ?? false shownWhen = try c.decodeIfPresent(ShownWhen.self, forKey: .shownWhen) secret = try c.decodeIfPresent(Bool.self, forKey: .secret) redWhen = try c.decodeIfPresent([String].self, forKey: .redWhen) presentation = try c.decodeIfPresent(String.self, forKey: .presentation) choicesFrom = try c.decodeIfPresent(String.self, forKey: .choicesFrom) labels = try c.decodeIfPresent([String: String].self, forKey: .labels) choiceNames = try c.decodeIfPresent([String: String].self, forKey: .choiceNames) until = try c.decodeIfPresent(String.self, forKey: .until) size = try c.decodeIfPresent([String].self, forKey: .size) caption = try c.decodeIfPresent(String.self, forKey: .caption) captionFallback = try c.decodeIfPresent(String.self, forKey: .captionFallback) plainBefore = try c.decodeIfPresent(String.self, forKey: .plainBefore) plainAfter = try c.decodeIfPresent(String.self, forKey: .plainAfter) opens = try c.decodeIfPresent(RecordOpens.self, forKey: .opens) poster = try c.decodeIfPresent(String.self, forKey: .poster) zone = try c.decodeIfPresent(Bool.self, forKey: .zone) ?? false untimed = try c.decodeIfPresent(String.self, forKey: .untimed) yearly = try c.decodeIfPresent(Bool.self, forKey: .yearly) ?? false reach = try? c.decodeIfPresent(DefinitionColumnReach.self, forKey: .reach) provenance = try c.decodeIfPresent(ColumnProvenance.self, forKey: .provenance) signs = try c.decodeIfPresent(AmountSigns.self, forKey: .signs) currency = try c.decodeIfPresent(String.self, forKey: .currency) signed = try c.decodeIfPresent(Bool.self, forKey: .signed) linkBy = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .linkBy) reveal = try c.decodeIfPresent(ColumnReveal.self, forKey: .reveal) tones = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .tones) markdown = try c.decodeIfPresent(Bool.self, forKey: .markdown) defaultValue = try c.decodeIfPresent(RecordValue.self, forKey: .defaultValue) computed = try? c.decodeIfPresent(DefinitionComputed.self, forKey: .computed) contributes = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .contributes) hidden = try c.decodeIfPresent(Bool.self, forKey: .hidden) edges = try c.decodeIfPresent(Bool.self, forKey: .edges) media = try c.decodeIfPresent(Bool.self, forKey: .media) families = try c.decodeIfPresent([String: String].self, forKey: .families) examples = try c.decodeIfPresent([String: [String]].self, forKey: .examples) says = try c.decodeIfPresent([String].self, forKey: .says) } func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(key, forKey: .key) try c.encodeIfPresent(name, forKey: .name) try c.encode(`type`, forKey: .`type`) try c.encodeIfPresent(counter, forKey: .counter) try c.encodeIfPresent(place, forKey: .place) if required != false { try c.encode(required, forKey: .required) } try c.encodeIfPresent(linkTo, forKey: .linkTo) try c.encodeIfPresent(choices, forKey: .choices) if indexed != false { try c.encode(indexed, forKey: .indexed) } if readonly != false { try c.encode(readonly, forKey: .readonly) } try c.encodeIfPresent(live, forKey: .live) try c.encodeIfPresent(fact, forKey: .fact) try c.encodeIfPresent(reading, forKey: .reading) try c.encodeIfPresent(decimals, forKey: .decimals) try c.encodeIfPresent(factJoin, forKey: .factJoin) try c.encodeIfPresent(toggleOn, forKey: .toggleOn) try c.encodeIfPresent(editableWhen, forKey: .editableWhen) try c.encodeIfPresent(placeholder, forKey: .placeholder) try c.encodeIfPresent(pastName, forKey: .pastName) try c.encodeIfPresent(pair, forKey: .pair) try c.encodeIfPresent(units, forKey: .units) try c.encodeIfPresent(format, forKey: .format) try c.encodeIfPresent(stamps, forKey: .stamps) try c.encodeIfPresent(moves, forKey: .moves) try c.encodeIfPresent(hints, forKey: .hints) try c.encodeIfPresent(objects, forKey: .objects) if multiple != false { try c.encode(multiple, forKey: .multiple) } if week != false { try c.encode(week, forKey: .week) } if month != false { try c.encode(month, forKey: .month) } try c.encodeIfPresent(shownWhen, forKey: .shownWhen) try c.encodeIfPresent(secret, forKey: .secret) try c.encodeIfPresent(redWhen, forKey: .redWhen) try c.encodeIfPresent(presentation, forKey: .presentation) try c.encodeIfPresent(choicesFrom, forKey: .choicesFrom) try c.encodeIfPresent(labels, forKey: .labels) try c.encodeIfPresent(choiceNames, forKey: .choiceNames) try c.encodeIfPresent(until, forKey: .until) try c.encodeIfPresent(size, forKey: .size) try c.encodeIfPresent(caption, forKey: .caption) try c.encodeIfPresent(captionFallback, forKey: .captionFallback) try c.encodeIfPresent(plainBefore, forKey: .plainBefore) try c.encodeIfPresent(plainAfter, forKey: .plainAfter) try c.encodeIfPresent(opens, forKey: .opens) try c.encodeIfPresent(poster, forKey: .poster) if zone != false { try c.encode(zone, forKey: .zone) } try c.encodeIfPresent(untimed, forKey: .untimed) if yearly != false { try c.encode(yearly, forKey: .yearly) } try c.encodeIfPresent(reach, forKey: .reach) try c.encodeIfPresent(provenance, forKey: .provenance) try c.encodeIfPresent(signs, forKey: .signs) try c.encodeIfPresent(currency, forKey: .currency) try c.encodeIfPresent(signed, forKey: .signed) try c.encodeIfPresent(linkBy, forKey: .linkBy) try c.encodeIfPresent(reveal, forKey: .reveal) try c.encodeIfPresent(tones, forKey: .tones) try c.encodeIfPresent(markdown, forKey: .markdown) try c.encodeIfPresent(defaultValue, forKey: .defaultValue) try c.encodeIfPresent(computed, forKey: .computed) try c.encodeIfPresent(contributes, forKey: .contributes) try c.encodeIfPresent(hidden, forKey: .hidden) try c.encodeIfPresent(edges, forKey: .edges) try c.encodeIfPresent(media, forKey: .media) try c.encodeIfPresent(families, forKey: .families) try c.encodeIfPresent(examples, forKey: .examples) try c.encodeIfPresent(says, forKey: .says) } } /// Storage of cotton_core::definitions::PlaceColumns. public struct DefinitionPlaceColumns: Codable, Hashable, Sendable { public var id: String public var country: String public var zone: String public var lat: String? = nil public var lng: String? = nil public var version: String? = nil public init(_generated: Void, id: String, country: String, zone: String) { self.id = id self.country = country self.zone = zone } public enum CodingKeys: String, CodingKey, CaseIterable { case id = "id" case country = "country" case zone = "zone" case lat = "lat" case lng = "lng" case version = "version" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) id = try c.decode(String.self, forKey: .id) country = try c.decode(String.self, forKey: .country) zone = try c.decode(String.self, forKey: .zone) lat = try c.decodeIfPresent(String.self, forKey: .lat) lng = try c.decodeIfPresent(String.self, forKey: .lng) version = try c.decodeIfPresent(String.self, forKey: .version) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) try c.encode(country, forKey: .country) try c.encode(zone, forKey: .zone) try c.encodeIfPresent(lat, forKey: .lat) try c.encodeIfPresent(lng, forKey: .lng) try c.encodeIfPresent(version, forKey: .version) } } /// Storage of cotton_core::definitions::ShippedView. public struct DefinitionShippedView: Codable, Hashable, Sendable { public var face: DefinitionViewFace public var name: String public var chart: DefinitionJSONValue? = nil public var opens: String? = nil public var `when`: DefinitionJSONValue? = nil public init(_generated: Void, face: DefinitionViewFace, name: String) { self.face = face self.name = name } public enum CodingKeys: String, CodingKey, CaseIterable { case face = "face" case name = "name" case chart = "chart" case opens = "opens" case `when` = "when" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) face = try c.decode(DefinitionViewFace.self, forKey: .face) name = try c.decode(String.self, forKey: .name) chart = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .chart) opens = try c.decodeIfPresent(String.self, forKey: .opens) `when` = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .`when`) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(face, forKey: .face) try c.encode(name, forKey: .name) try c.encodeIfPresent(chart, forKey: .chart) try c.encodeIfPresent(opens, forKey: .opens) try c.encodeIfPresent(`when`, forKey: .`when`) } } /// Storage of cotton_core::definitions::RecordCommand. public struct DefinitionRecordCommand: Codable, Hashable, Sendable { public var id: String public var label: String public var kind: DefinitionCommandKind? = nil public var verb: String? = nil public var method: String? = nil public var data: [String: RecordValue]? = nil public var destructive: Bool? = nil public var confirm: String? = nil public var bindings: [String: String]? = nil public var `when`: [String: RecordValue]? = nil public var receipt: String? = nil public var undo: String? = nil public var opens: String? = nil public var view: String? = nil public var copies: String? = nil public var pickTable: String? = nil public var pick: RecordCommandPick? = nil public var picks: [RecordCommandPick]? = nil public var doesWord: String? = nil public var object: String? = nil public var sheet: String? = nil public var form: Bool? = nil public var reveals: RecordCommandReveal? = nil public var lands: DefinitionJSONValue? = nil public var signedOut: String? = nil public var list: RecordCommandList? = nil public var spoken: DefinitionCommandSpoken? = nil public init(_generated: Void, id: String, label: String) { self.id = id self.label = label } public enum CodingKeys: String, CodingKey, CaseIterable { case id = "id" case label = "label" case kind = "kind" case verb = "verb" case method = "method" case data = "data" case destructive = "destructive" case confirm = "confirm" case bindings = "bindings" case `when` = "when" case receipt = "receipt" case undo = "undo" case opens = "opens" case view = "view" case copies = "copies" case pickTable = "pick_table" case pick = "pick" case picks = "picks" case doesWord = "does" case object = "object" case sheet = "sheet" case form = "form" case reveals = "reveals" case lands = "lands" case signedOut = "signed_out" case list = "list" case spoken = "spoken" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) id = try c.decode(String.self, forKey: .id) label = try c.decode(String.self, forKey: .label) kind = try c.decodeIfPresent(DefinitionCommandKind.self, forKey: .kind) verb = try c.decodeIfPresent(String.self, forKey: .verb) method = try c.decodeIfPresent(String.self, forKey: .method) data = try c.decodeIfPresent([String: RecordValue].self, forKey: .data) destructive = try c.decodeIfPresent(Bool.self, forKey: .destructive) confirm = try c.decodeIfPresent(String.self, forKey: .confirm) bindings = try c.decodeIfPresent([String: String].self, forKey: .bindings) `when` = try c.decodeIfPresent([String: RecordValue].self, forKey: .`when`) receipt = try c.decodeIfPresent(String.self, forKey: .receipt) undo = try c.decodeIfPresent(String.self, forKey: .undo) opens = try c.decodeIfPresent(String.self, forKey: .opens) view = try c.decodeIfPresent(String.self, forKey: .view) copies = try c.decodeIfPresent(String.self, forKey: .copies) pickTable = try c.decodeIfPresent(String.self, forKey: .pickTable) pick = try c.decodeIfPresent(RecordCommandPick.self, forKey: .pick) picks = try c.decodeIfPresent([RecordCommandPick].self, forKey: .picks) doesWord = try c.decodeIfPresent(String.self, forKey: .doesWord) object = try c.decodeIfPresent(String.self, forKey: .object) sheet = try c.decodeIfPresent(String.self, forKey: .sheet) form = try c.decodeIfPresent(Bool.self, forKey: .form) reveals = try c.decodeIfPresent(RecordCommandReveal.self, forKey: .reveals) lands = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .lands) signedOut = try c.decodeIfPresent(String.self, forKey: .signedOut) list = try c.decodeIfPresent(RecordCommandList.self, forKey: .list) spoken = try c.decodeIfPresent(DefinitionCommandSpoken.self, forKey: .spoken) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) try c.encode(label, forKey: .label) try c.encodeIfPresent(kind, forKey: .kind) try c.encodeIfPresent(verb, forKey: .verb) try c.encodeIfPresent(method, forKey: .method) try c.encodeIfPresent(data, forKey: .data) try c.encodeIfPresent(destructive, forKey: .destructive) try c.encodeIfPresent(confirm, forKey: .confirm) try c.encodeIfPresent(bindings, forKey: .bindings) try c.encodeIfPresent(`when`, forKey: .`when`) try c.encodeIfPresent(receipt, forKey: .receipt) try c.encodeIfPresent(undo, forKey: .undo) try c.encodeIfPresent(opens, forKey: .opens) try c.encodeIfPresent(view, forKey: .view) try c.encodeIfPresent(copies, forKey: .copies) try c.encodeIfPresent(pickTable, forKey: .pickTable) try c.encodeIfPresent(pick, forKey: .pick) try c.encodeIfPresent(picks, forKey: .picks) try c.encodeIfPresent(doesWord, forKey: .doesWord) try c.encodeIfPresent(object, forKey: .object) try c.encodeIfPresent(sheet, forKey: .sheet) try c.encodeIfPresent(form, forKey: .form) try c.encodeIfPresent(reveals, forKey: .reveals) try c.encodeIfPresent(lands, forKey: .lands) try c.encodeIfPresent(signedOut, forKey: .signedOut) try c.encodeIfPresent(list, forKey: .list) try c.encodeIfPresent(spoken, forKey: .spoken) } } /// Storage of cotton_core::definitions::BoardDefinition. public struct DefinitionBoardDefinition: Codable, Hashable, Sendable { public var formatVersion: Int? = nil public var id: String public var parts: [BoardPart] public var variants: [BoardVariant] = [] public var picture: DefinitionToolPicture? = nil public var baseHash: String? = nil public var unknown: [String: DefinitionJSONValue] = [:] public var fallbacks: [String] = [] public init(_generated: Void, id: String, parts: [BoardPart]) { self.id = id self.parts = parts } public enum CodingKeys: String, CodingKey, CaseIterable { case formatVersion = "format_version" case id = "id" case parts = "parts" case variants = "variants" case picture = "picture" case baseHash = "base_hash" case fallbacks = "fallbacks" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) formatVersion = try c.decodeIfPresent(Int.self, forKey: .formatVersion) id = try c.decode(String.self, forKey: .id) parts = try c.decode([BoardPart].self, forKey: .parts) variants = try c.decodeIfPresent([BoardVariant].self, forKey: .variants) ?? [] picture = try c.decodeIfPresent(DefinitionToolPicture.self, forKey: .picture) baseHash = try c.decodeIfPresent(String.self, forKey: .baseHash) fallbacks = try c.decodeIfPresent([String].self, forKey: .fallbacks) ?? [] let all = try decoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for key in all.allKeys where !known.contains(key.stringValue) { unknown[key.stringValue] = try all.decode(DefinitionJSONValue.self, forKey: key) } } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(formatVersion, forKey: .formatVersion) try c.encode(id, forKey: .id) try c.encode(parts, forKey: .parts) if !variants.isEmpty { try c.encode(variants, forKey: .variants) } try c.encodeIfPresent(picture, forKey: .picture) try c.encodeIfPresent(baseHash, forKey: .baseHash) if !fallbacks.isEmpty { try c.encode(fallbacks, forKey: .fallbacks) } var all = encoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for (key, value) in unknown where !known.contains(key) { try all.encode(value, forKey: DefinitionCodingKey(key)) } } } /// Storage of cotton_core::definitions::BoardPart. public struct DefinitionBoardPart: Codable, Hashable, Sendable { public var kind: String public var settings: [String: DefinitionJSONValue] = [:] public init(_generated: Void, kind: String) { self.kind = kind } public enum CodingKeys: String, CodingKey, CaseIterable { case kind = "kind" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) kind = try c.decode(String.self, forKey: .kind) let all = try decoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for key in all.allKeys where !known.contains(key.stringValue) { settings[key.stringValue] = try all.decode(DefinitionJSONValue.self, forKey: key) } } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(kind, forKey: .kind) var all = encoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for (key, value) in settings where !known.contains(key) { try all.encode(value, forKey: DefinitionCodingKey(key)) } } } /// Storage of cotton_core::definitions::BoardVariant. public struct DefinitionBoardVariant: Codable, Hashable, Sendable { public var `when`: [String: DefinitionJSONValue] public var parts: [BoardPart] public init(_generated: Void, `when`: [String: DefinitionJSONValue], parts: [BoardPart]) { self.`when` = `when` self.parts = parts } public enum CodingKeys: String, CodingKey, CaseIterable { case `when` = "when" case parts = "parts" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) `when` = try c.decode([String: DefinitionJSONValue].self, forKey: .`when`) parts = try c.decode([BoardPart].self, forKey: .parts) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(`when`, forKey: .`when`) try c.encode(parts, forKey: .parts) } } /// Storage of cotton_core::definitions::ListSort. public struct DefinitionListSort: Codable, Hashable, Sendable { public var column: String public var descending: Bool = false public var tie: String? = nil public var next: Bool? = nil public var tieDescending: Bool? = nil public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case descending = "descending" case tie = "tie" case next = "next" case tieDescending = "tie_descending" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) descending = try c.decodeIfPresent(Bool.self, forKey: .descending) ?? false tie = try c.decodeIfPresent(String.self, forKey: .tie) next = try c.decodeIfPresent(Bool.self, forKey: .next) tieDescending = try c.decodeIfPresent(Bool.self, forKey: .tieDescending) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) if descending != false { try c.encode(descending, forKey: .descending) } try c.encodeIfPresent(tie, forKey: .tie) try c.encodeIfPresent(next, forKey: .next) try c.encodeIfPresent(tieDescending, forKey: .tieDescending) } } /// Storage of cotton_core::definitions::ListGrid. public struct DefinitionListGrid: Codable, Hashable, Sendable { public var columns: Int public init(_generated: Void, columns: Int) { self.columns = columns } public enum CodingKeys: String, CodingKey, CaseIterable { case columns = "columns" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) columns = try c.decode(Int.self, forKey: .columns) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(columns, forKey: .columns) } } /// Storage of cotton_core::definitions::ListPaste. public struct DefinitionListPaste: Codable, Hashable, Sendable { public var column: String public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) } } /// Storage of cotton_core::definitions::ListMonths. public struct DefinitionListMonths: Codable, Hashable, Sendable { public var over: Int? = nil public var undated: String? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case over = "over" case undated = "undated" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) over = try c.decodeIfPresent(Int.self, forKey: .over) undated = try c.decodeIfPresent(String.self, forKey: .undated) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(over, forKey: .over) try c.encodeIfPresent(undated, forKey: .undated) } } /// Storage of cotton_core::definitions::ListSelect. public struct DefinitionListSelect: Codable, Hashable, Sendable { public var verb: DefinitionSelectVerb = .delete public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case verb = "verb" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) verb = try c.decodeIfPresent(DefinitionSelectVerb.self, forKey: .verb) ?? .delete } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if verb != .delete { try c.encode(verb, forKey: .verb) } } } /// Storage of cotton_core::definitions::MenuLine. public struct DefinitionMenuLine: Codable, Hashable, Sendable { public var label: String public var path: String public var object: String? = nil public init(_generated: Void, label: String, path: String) { self.label = label self.path = path } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case path = "path" case object = "object" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) path = try c.decode(String.self, forKey: .path) object = try c.decodeIfPresent(String.self, forKey: .object) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encode(path, forKey: .path) try c.encodeIfPresent(object, forKey: .object) } } /// Storage of cotton_core::definitions::LinkTiles. public struct DefinitionLinkTiles: Codable, Hashable, Sendable { public var after: Int public init(_generated: Void, after: Int) { self.after = after } public enum CodingKeys: String, CodingKey, CaseIterable { case after = "after" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) after = try c.decode(Int.self, forKey: .after) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(after, forKey: .after) } } /// Storage of cotton_core::definitions::PolaroidLayout. public struct DefinitionPolaroidLayout: Codable, Hashable, Sendable { public var caption: String? = nil public var title: String? = nil public var subtitle: String? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case caption = "caption" case title = "title" case subtitle = "subtitle" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) caption = try c.decodeIfPresent(String.self, forKey: .caption) title = try c.decodeIfPresent(String.self, forKey: .title) subtitle = try c.decodeIfPresent(String.self, forKey: .subtitle) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(caption, forKey: .caption) try c.encodeIfPresent(title, forKey: .title) try c.encodeIfPresent(subtitle, forKey: .subtitle) } } /// Storage of cotton_core::definitions::ListClear. public struct DefinitionListClear: Codable, Hashable, Sendable { public var label: String public var note: String? = nil public var title: String? = nil public var message: String = "" public var confirm: String = "Delete" public var cancel: String? = nil public var done: String? = nil public init(_generated: Void, label: String) { self.label = label } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case note = "note" case title = "title" case message = "message" case confirm = "confirm" case cancel = "cancel" case done = "done" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) note = try c.decodeIfPresent(String.self, forKey: .note) title = try c.decodeIfPresent(String.self, forKey: .title) message = try c.decodeIfPresent(String.self, forKey: .message) ?? "" confirm = try c.decodeIfPresent(String.self, forKey: .confirm) ?? "Delete" cancel = try c.decodeIfPresent(String.self, forKey: .cancel) done = try c.decodeIfPresent(String.self, forKey: .done) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encodeIfPresent(note, forKey: .note) try c.encodeIfPresent(title, forKey: .title) if message != "" { try c.encode(message, forKey: .message) } if confirm != "Delete" { try c.encode(confirm, forKey: .confirm) } try c.encodeIfPresent(cancel, forKey: .cancel) try c.encodeIfPresent(done, forKey: .done) } } /// Storage of cotton_core::definitions::DeletionWords. public struct DefinitionDeletionWords: Codable, Hashable, Sendable { public var one: String? = nil public var other: String? = nil public var size: String? = nil public var undo: Bool = true public var confirm: String = "Delete" public var cancel: String? = nil public var label: String? = nil public var asks: Bool = true public var bin: Bool = false public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case one = "one" case other = "other" case size = "size" case undo = "undo" case confirm = "confirm" case cancel = "cancel" case label = "label" case asks = "asks" case bin = "bin" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) one = try c.decodeIfPresent(String.self, forKey: .one) other = try c.decodeIfPresent(String.self, forKey: .other) size = try c.decodeIfPresent(String.self, forKey: .size) undo = try c.decodeIfPresent(Bool.self, forKey: .undo) ?? true confirm = try c.decodeIfPresent(String.self, forKey: .confirm) ?? "Delete" cancel = try c.decodeIfPresent(String.self, forKey: .cancel) label = try c.decodeIfPresent(String.self, forKey: .label) asks = try c.decodeIfPresent(Bool.self, forKey: .asks) ?? true bin = try c.decodeIfPresent(Bool.self, forKey: .bin) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(one, forKey: .one) try c.encodeIfPresent(other, forKey: .other) try c.encodeIfPresent(size, forKey: .size) if undo != true { try c.encode(undo, forKey: .undo) } if confirm != "Delete" { try c.encode(confirm, forKey: .confirm) } try c.encodeIfPresent(cancel, forKey: .cancel) try c.encodeIfPresent(label, forKey: .label) if asks != true { try c.encode(asks, forKey: .asks) } if bin != false { try c.encode(bin, forKey: .bin) } } } /// Storage of cotton_core::definitions::ListGrouping. public struct DefinitionListGrouping: Codable, Hashable, Sendable { public var column: String public var sections: [DefinitionListGroup] = [] public var summary: [DefinitionTileSummary] = [] public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case sections = "sections" case summary = "summary" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) sections = try c.decodeIfPresent([DefinitionListGroup].self, forKey: .sections) ?? [] summary = try c.decodeIfPresent([DefinitionTileSummary].self, forKey: .summary) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) if !sections.isEmpty { try c.encode(sections, forKey: .sections) } if !summary.isEmpty { try c.encode(summary, forKey: .summary) } } } /// Storage of cotton_core::definitions::ListGroup. public struct DefinitionListGroup: Codable, Hashable, Sendable { public var heading: String? = nil public var values: [String] public var note: String? = nil public var closed: Bool = false public var due: DefinitionGroupDue? = nil public init(_generated: Void, values: [String]) { self.values = values } public enum CodingKeys: String, CodingKey, CaseIterable { case heading = "heading" case values = "values" case note = "note" case closed = "closed" case due = "due" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) heading = try c.decodeIfPresent(String.self, forKey: .heading) values = try c.decode([String].self, forKey: .values) note = try c.decodeIfPresent(String.self, forKey: .note) closed = try c.decodeIfPresent(Bool.self, forKey: .closed) ?? false due = try c.decodeIfPresent(DefinitionGroupDue.self, forKey: .due) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(heading, forKey: .heading) try c.encode(values, forKey: .values) try c.encodeIfPresent(note, forKey: .note) if closed != false { try c.encode(closed, forKey: .closed) } try c.encodeIfPresent(due, forKey: .due) } } /// Storage of cotton_core::definitions::GroupDue. public struct DefinitionGroupDue: Codable, Hashable, Sendable { public var column: String public var late: String public var soon: String public var later: String public var undated: String public init(_generated: Void, column: String, late: String, soon: String, later: String, undated: String) { self.column = column self.late = late self.soon = soon self.later = later self.undated = undated } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case late = "late" case soon = "soon" case later = "later" case undated = "undated" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) late = try c.decode(String.self, forKey: .late) soon = try c.decode(String.self, forKey: .soon) later = try c.decode(String.self, forKey: .later) undated = try c.decode(String.self, forKey: .undated) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(late, forKey: .late) try c.encode(soon, forKey: .soon) try c.encode(later, forKey: .later) try c.encode(undated, forKey: .undated) } } /// Storage of cotton_core::definitions::ColumnUnits. public struct DefinitionColumnUnits: Codable, Hashable, Sendable { public var one: String public var other: String public var zero: String? = nil public init(_generated: Void, one: String, other: String) { self.one = one self.other = other } public enum CodingKeys: String, CodingKey, CaseIterable { case one = "one" case other = "other" case zero = "zero" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) one = try c.decode(String.self, forKey: .one) other = try c.decode(String.self, forKey: .other) zero = try c.decodeIfPresent(String.self, forKey: .zero) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(one, forKey: .one) try c.encode(other, forKey: .other) try c.encodeIfPresent(zero, forKey: .zero) } } /// Storage of cotton_core::definitions::EmptyWords. public struct DefinitionEmptyWords: Codable, Hashable, Sendable { public var title: String public var message: String? = nil public var search: DefinitionNoMatchWords? = nil public init(_generated: Void, title: String) { self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case title = "title" case message = "message" case search = "search" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) title = try c.decode(String.self, forKey: .title) message = try c.decodeIfPresent(String.self, forKey: .message) search = try c.decodeIfPresent(DefinitionNoMatchWords.self, forKey: .search) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(title, forKey: .title) try c.encodeIfPresent(message, forKey: .message) try c.encodeIfPresent(search, forKey: .search) } } /// Storage of cotton_core::definitions::NoMatchWords. public struct DefinitionNoMatchWords: Codable, Hashable, Sendable { public var title: String public var message: String? = nil public init(_generated: Void, title: String) { self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case title = "title" case message = "message" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) title = try c.decode(String.self, forKey: .title) message = try c.decodeIfPresent(String.self, forKey: .message) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(title, forKey: .title) try c.encodeIfPresent(message, forKey: .message) } } /// Storage of cotton_core::definitions::RecentLayout. public struct DefinitionRecentLayout: Codable, Hashable, Sendable { public var column: String public var count: Int = 2 public var over: Int = 3 public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case count = "count" case over = "over" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) count = try c.decodeIfPresent(Int.self, forKey: .count) ?? 2 over = try c.decodeIfPresent(Int.self, forKey: .over) ?? 3 } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) if count != 2 { try c.encode(count, forKey: .count) } if over != 3 { try c.encode(over, forKey: .over) } } } /// Storage of cotton_core::definitions::KeptBy. public struct DefinitionKeptBy: Codable, Hashable, Sendable { public var `when`: String public var says: String public init(_generated: Void, `when`: String, says: String) { self.`when` = `when` self.says = says } public enum CodingKeys: String, CodingKey, CaseIterable { case `when` = "when" case says = "says" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) `when` = try c.decode(String.self, forKey: .`when`) says = try c.decode(String.self, forKey: .says) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(`when`, forKey: .`when`) try c.encode(says, forKey: .says) } } /// Storage of cotton_core::definitions::RecordExport. public struct DefinitionRecordExport: Codable, Hashable, Sendable { public var label: String public var column: String public var `extension`: String public init(_generated: Void, label: String, column: String, `extension`: String) { self.label = label self.column = column self.`extension` = `extension` } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case column = "column" case `extension` = "extension" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) column = try c.decode(String.self, forKey: .column) `extension` = try c.decode(String.self, forKey: .`extension`) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encode(column, forKey: .column) try c.encode(`extension`, forKey: .`extension`) } } /// Storage of cotton_core::definitions::ListCreate. public struct DefinitionListCreate: Codable, Hashable, Sendable { public var label: String public var dated: String? = nil public var path: String? = nil public var method: String? = nil public var act: DefinitionCreateAct? = nil public var doors: [DefinitionCreateDoor] = [] public init(_generated: Void, label: String) { self.label = label } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case dated = "dated" case path = "path" case method = "method" case act = "act" case doors = "doors" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) dated = try c.decodeIfPresent(String.self, forKey: .dated) path = try c.decodeIfPresent(String.self, forKey: .path) method = try c.decodeIfPresent(String.self, forKey: .method) act = try c.decodeIfPresent(DefinitionCreateAct.self, forKey: .act) doors = try c.decodeIfPresent([DefinitionCreateDoor].self, forKey: .doors) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encodeIfPresent(dated, forKey: .dated) try c.encodeIfPresent(path, forKey: .path) try c.encodeIfPresent(method, forKey: .method) try c.encodeIfPresent(act, forKey: .act) if !doors.isEmpty { try c.encode(doors, forKey: .doors) } } } /// Storage of cotton_core::definitions::CreateAct. public struct DefinitionCreateAct: Codable, Hashable, Sendable { public var name: String public var argument: String public var lands: String? = nil public var signedOut: String? = nil public init(_generated: Void, name: String, argument: String) { self.name = name self.argument = argument } public enum CodingKeys: String, CodingKey, CaseIterable { case name = "name" case argument = "argument" case lands = "lands" case signedOut = "signed_out" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) name = try c.decode(String.self, forKey: .name) argument = try c.decode(String.self, forKey: .argument) lands = try c.decodeIfPresent(String.self, forKey: .lands) signedOut = try c.decodeIfPresent(String.self, forKey: .signedOut) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(name, forKey: .name) try c.encode(argument, forKey: .argument) try c.encodeIfPresent(lands, forKey: .lands) try c.encodeIfPresent(signedOut, forKey: .signedOut) } } /// Storage of cotton_core::definitions::CreateDoor. public struct DefinitionCreateDoor: Codable, Hashable, Sendable { public var id: String public var label: String public var object: String? = nil public var act: DefinitionCreateAct? = nil public var files: DefinitionCreateFiles? = nil public var pick: DefinitionCreatePick? = nil public var draft: DefinitionCreateDraft? = nil public var reads: DefinitionDeviceReads? = nil public init(_generated: Void, id: String, label: String) { self.id = id self.label = label } public enum CodingKeys: String, CodingKey, CaseIterable { case id = "id" case label = "label" case object = "object" case act = "act" case files = "files" case pick = "pick" case draft = "draft" case reads = "reads" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) id = try c.decode(String.self, forKey: .id) label = try c.decode(String.self, forKey: .label) object = try c.decodeIfPresent(String.self, forKey: .object) act = try c.decodeIfPresent(DefinitionCreateAct.self, forKey: .act) files = try c.decodeIfPresent(DefinitionCreateFiles.self, forKey: .files) pick = try c.decodeIfPresent(DefinitionCreatePick.self, forKey: .pick) draft = try c.decodeIfPresent(DefinitionCreateDraft.self, forKey: .draft) reads = try c.decodeIfPresent(DefinitionDeviceReads.self, forKey: .reads) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) try c.encode(label, forKey: .label) try c.encodeIfPresent(object, forKey: .object) try c.encodeIfPresent(act, forKey: .act) try c.encodeIfPresent(files, forKey: .files) try c.encodeIfPresent(pick, forKey: .pick) try c.encodeIfPresent(draft, forKey: .draft) try c.encodeIfPresent(reads, forKey: .reads) } } /// Storage of cotton_core::definitions::CreateFiles. public struct DefinitionCreateFiles: Codable, Hashable, Sendable { public var types: [String] public var many: Bool = false public init(_generated: Void, types: [String]) { self.types = types } public enum CodingKeys: String, CodingKey, CaseIterable { case types = "types" case many = "many" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) types = try c.decode([String].self, forKey: .types) many = try c.decodeIfPresent(Bool.self, forKey: .many) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(types, forKey: .types) if many { try c.encode(many, forKey: .many) } } } /// Storage of cotton_core::definitions::CreatePick. public struct DefinitionCreatePick: Codable, Hashable, Sendable { public var source: DefinitionPickSource public var kinds: [DefinitionPictureKind] public var many: Bool = false public init(_generated: Void, source: DefinitionPickSource, kinds: [DefinitionPictureKind]) { self.source = source self.kinds = kinds } public enum CodingKeys: String, CodingKey, CaseIterable { case source = "source" case kinds = "kinds" case many = "many" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) source = try c.decode(DefinitionPickSource.self, forKey: .source) kinds = try c.decode([DefinitionPictureKind].self, forKey: .kinds) many = try c.decodeIfPresent(Bool.self, forKey: .many) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(source, forKey: .source) try c.encode(kinds, forKey: .kinds) if many { try c.encode(many, forKey: .many) } } } /// Storage of cotton_core::definitions::CreateDraft. public struct DefinitionCreateDraft: Codable, Hashable, Sendable { public var values: [String: RecordValue] = [:] public var dated: String? = nil public var asks: [String] = [] public var account: String? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case values = "values" case dated = "dated" case asks = "asks" case account = "account" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) values = try c.decodeIfPresent([String: RecordValue].self, forKey: .values) ?? [:] dated = try c.decodeIfPresent(String.self, forKey: .dated) asks = try c.decodeIfPresent([String].self, forKey: .asks) ?? [] account = try c.decodeIfPresent(String.self, forKey: .account) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(values, forKey: .values) try c.encodeIfPresent(dated, forKey: .dated) if !asks.isEmpty { try c.encode(asks, forKey: .asks) } try c.encodeIfPresent(account, forKey: .account) } } /// Storage of cotton_core::definitions::CountWords. public struct DefinitionCountWords: Codable, Hashable, Sendable { public var column: String public var units: [String: DefinitionColumnUnits] public var order: [String]? = nil public init(_generated: Void, column: String, units: [String: DefinitionColumnUnits]) { self.column = column self.units = units } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case units = "units" case order = "order" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) units = try c.decode([String: DefinitionColumnUnits].self, forKey: .units) order = try c.decodeIfPresent([String].self, forKey: .order) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(units, forKey: .units) try c.encodeIfPresent(order, forKey: .order) } } /// Storage of cotton_core::definitions::LiveReading. public struct DefinitionLiveReading: Codable, Hashable, Sendable { public var every: Double public init(_generated: Void, every: Double) { self.every = every } public enum CodingKeys: String, CodingKey, CaseIterable { case every = "every" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) every = try c.decode(Double.self, forKey: .every) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(every, forKey: .every) } } /// Storage of cotton_core::definitions::ListFilter. public struct DefinitionListFilter: Codable, Hashable, Sendable { public var column: String public var tabs: Bool = true public var all: String = "all" public var words: [String: String] = [:] public var order: [String]? = nil public var empty: [String: DefinitionEmptyWords] = [:] public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case tabs = "tabs" case all = "all" case words = "words" case order = "order" case empty = "empty" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) tabs = try c.decodeIfPresent(Bool.self, forKey: .tabs) ?? true all = try c.decodeIfPresent(String.self, forKey: .all) ?? "all" words = try c.decodeIfPresent([String: String].self, forKey: .words) ?? [:] order = try c.decodeIfPresent([String].self, forKey: .order) empty = try c.decodeIfPresent([String: DefinitionEmptyWords].self, forKey: .empty) ?? [:] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) if tabs != true { try c.encode(tabs, forKey: .tabs) } if all != "all" { try c.encode(all, forKey: .all) } if !words.isEmpty { try c.encode(words, forKey: .words) } try c.encodeIfPresent(order, forKey: .order) if !empty.isEmpty { try c.encode(empty, forKey: .empty) } } } /// Storage of cotton_core::definitions::ListLink. public struct DefinitionListLink: Codable, Hashable, Sendable { public var label: String public var table: String public var `where`: [String: RecordValue] = [:] public var words: String? = nil public var path: String? = nil public var lead: Bool = false public var above: Bool = false public var review: Bool = false public var hidesEmpty: Bool = false public var units: DefinitionColumnUnits? = nil public var `when`: DefinitionJSONValue? = nil public init(_generated: Void, label: String, table: String) { self.label = label self.table = table } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case table = "table" case `where` = "where" case words = "words" case path = "path" case lead = "lead" case above = "above" case review = "review" case hidesEmpty = "hides_empty" case units = "units" case `when` = "when" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) table = try c.decode(String.self, forKey: .table) `where` = try c.decodeIfPresent([String: RecordValue].self, forKey: .`where`) ?? [:] words = try c.decodeIfPresent(String.self, forKey: .words) path = try c.decodeIfPresent(String.self, forKey: .path) lead = try c.decodeIfPresent(Bool.self, forKey: .lead) ?? false above = try c.decodeIfPresent(Bool.self, forKey: .above) ?? false review = try c.decodeIfPresent(Bool.self, forKey: .review) ?? false hidesEmpty = try c.decodeIfPresent(Bool.self, forKey: .hidesEmpty) ?? false units = try c.decodeIfPresent(DefinitionColumnUnits.self, forKey: .units) `when` = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .`when`) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encode(table, forKey: .table) if !`where`.isEmpty { try c.encode(`where`, forKey: .`where`) } try c.encodeIfPresent(words, forKey: .words) try c.encodeIfPresent(path, forKey: .path) if lead != false { try c.encode(lead, forKey: .lead) } if above != false { try c.encode(above, forKey: .above) } if review != false { try c.encode(review, forKey: .review) } if hidesEmpty != false { try c.encode(hidesEmpty, forKey: .hidesEmpty) } try c.encodeIfPresent(units, forKey: .units) try c.encodeIfPresent(`when`, forKey: .`when`) } } /// Storage of cotton_core::definitions::ListUpcoming. public struct DefinitionListUpcoming: Codable, Hashable, Sendable { public var dates: [String] = [] public var undated: String? = nil public var late: String? = nil public var later: String? = nil public var horizon: Int = 7 public var series: String? = nil public var lead: String? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case dates = "dates" case undated = "undated" case late = "late" case later = "later" case horizon = "horizon" case series = "series" case lead = "lead" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) dates = try c.decodeIfPresent([String].self, forKey: .dates) ?? [] undated = try c.decodeIfPresent(String.self, forKey: .undated) late = try c.decodeIfPresent(String.self, forKey: .late) later = try c.decodeIfPresent(String.self, forKey: .later) horizon = try c.decodeIfPresent(Int.self, forKey: .horizon) ?? 7 series = try c.decodeIfPresent(String.self, forKey: .series) lead = try c.decodeIfPresent(String.self, forKey: .lead) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if !dates.isEmpty { try c.encode(dates, forKey: .dates) } try c.encodeIfPresent(undated, forKey: .undated) try c.encodeIfPresent(late, forKey: .late) try c.encodeIfPresent(later, forKey: .later) if horizon != 7 { try c.encode(horizon, forKey: .horizon) } try c.encodeIfPresent(series, forKey: .series) try c.encodeIfPresent(lead, forKey: .lead) } } /// Storage of cotton_core::definitions::ChipRow. public struct DefinitionChipRow: Codable, Hashable, Sendable { public var column: String public var sends: [String: RecordValue] = [:] public var label: String? = nil public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case sends = "sends" case label = "label" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) sends = try c.decodeIfPresent([String: RecordValue].self, forKey: .sends) ?? [:] label = try c.decodeIfPresent(String.self, forKey: .label) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) if !sends.isEmpty { try c.encode(sends, forKey: .sends) } try c.encodeIfPresent(label, forKey: .label) } } /// Storage of cotton_core::definitions::ProjectsRead. public struct DefinitionProjectsRead: Codable, Hashable, Sendable { public var kind: String public var read: String public var families: [String] public init(_generated: Void, kind: String, read: String, families: [String]) { self.kind = kind self.read = read self.families = families } public enum CodingKeys: String, CodingKey, CaseIterable { case kind = "kind" case read = "read" case families = "families" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) kind = try c.decode(String.self, forKey: .kind) read = try c.decode(String.self, forKey: .read) families = try c.decode([String].self, forKey: .families) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(kind, forKey: .kind) try c.encode(read, forKey: .read) try c.encode(families, forKey: .families) } } /// Storage of cotton_core::definitions::BinnedRows. public struct DefinitionBinnedRows: Codable, Hashable, Sendable { public var from: String public var restore: [String: String] public init(_generated: Void, from: String, restore: [String: String]) { self.from = from self.restore = restore } public enum CodingKeys: String, CodingKey, CaseIterable { case from = "from" case restore = "restore" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) from = try c.decode(String.self, forKey: .from) restore = try c.decode([String: String].self, forKey: .restore) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(from, forKey: .from) try c.encode(restore, forKey: .restore) } } /// Storage of cotton_core::definitions::LinkedWhen. public struct DefinitionLinkedWhen: Codable, Hashable, Sendable { public var scheduled: String? = nil public var made: String? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case scheduled = "scheduled" case made = "made" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) scheduled = try c.decodeIfPresent(String.self, forKey: .scheduled) made = try c.decodeIfPresent(String.self, forKey: .made) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(scheduled, forKey: .scheduled) try c.encodeIfPresent(made, forKey: .made) } } /// Storage of cotton_core::definitions::CoverLayout. public struct DefinitionCoverLayout: Codable, Hashable, Sendable { public var footer: [String] = [] public var bound: Bool = false public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case footer = "footer" case bound = "bound" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) footer = try c.decodeIfPresent([String].self, forKey: .footer) ?? [] bound = try c.decodeIfPresent(Bool.self, forKey: .bound) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if !footer.isEmpty { try c.encode(footer, forKey: .footer) } if bound != false { try c.encode(bound, forKey: .bound) } } } /// Storage of cotton_core::definitions::TableViewer. public struct DefinitionTableViewer: Codable, Hashable, Sendable { public var words: DefinitionViewerWords? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case words = "words" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) words = try c.decodeIfPresent(DefinitionViewerWords.self, forKey: .words) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(words, forKey: .words) } } /// Storage of cotton_core::definitions::ViewerWords. public struct DefinitionViewerWords: Codable, Hashable, Sendable { public var close: String public var details: String public var more: String public var share: String public var position: String public var absent: String public var removed: String public var fetch: String public var fetching: String public var mapAbsent: String public var play: String public var pause: String public var mute: String public var unmute: String public var pictureInPicture: String public var search: String public var noMatch: String public var page: String public var goToPage: String public var go: String public var pinPress: String public var pinHint: String public var pinPlaceholder: String public var cancel: String public var save: String public var saving: String public init(_generated: Void, close: String, details: String, more: String, share: String, position: String, absent: String, removed: String, fetch: String, fetching: String, mapAbsent: String, play: String, pause: String, mute: String, unmute: String, pictureInPicture: String, search: String, noMatch: String, page: String, goToPage: String, go: String, pinPress: String, pinHint: String, pinPlaceholder: String, cancel: String, save: String, saving: String) { self.close = close self.details = details self.more = more self.share = share self.position = position self.absent = absent self.removed = removed self.fetch = fetch self.fetching = fetching self.mapAbsent = mapAbsent self.play = play self.pause = pause self.mute = mute self.unmute = unmute self.pictureInPicture = pictureInPicture self.search = search self.noMatch = noMatch self.page = page self.goToPage = goToPage self.go = go self.pinPress = pinPress self.pinHint = pinHint self.pinPlaceholder = pinPlaceholder self.cancel = cancel self.save = save self.saving = saving } public enum CodingKeys: String, CodingKey, CaseIterable { case close = "close" case details = "details" case more = "more" case share = "share" case position = "position" case absent = "absent" case removed = "removed" case fetch = "fetch" case fetching = "fetching" case mapAbsent = "map_absent" case play = "play" case pause = "pause" case mute = "mute" case unmute = "unmute" case pictureInPicture = "picture_in_picture" case search = "search" case noMatch = "no_match" case page = "page" case goToPage = "go_to_page" case go = "go" case pinPress = "pin_press" case pinHint = "pin_hint" case pinPlaceholder = "pin_placeholder" case cancel = "cancel" case save = "save" case saving = "saving" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) close = try c.decode(String.self, forKey: .close) details = try c.decode(String.self, forKey: .details) more = try c.decode(String.self, forKey: .more) share = try c.decode(String.self, forKey: .share) position = try c.decode(String.self, forKey: .position) absent = try c.decode(String.self, forKey: .absent) removed = try c.decode(String.self, forKey: .removed) fetch = try c.decode(String.self, forKey: .fetch) fetching = try c.decode(String.self, forKey: .fetching) mapAbsent = try c.decode(String.self, forKey: .mapAbsent) play = try c.decode(String.self, forKey: .play) pause = try c.decode(String.self, forKey: .pause) mute = try c.decode(String.self, forKey: .mute) unmute = try c.decode(String.self, forKey: .unmute) pictureInPicture = try c.decode(String.self, forKey: .pictureInPicture) search = try c.decode(String.self, forKey: .search) noMatch = try c.decode(String.self, forKey: .noMatch) page = try c.decode(String.self, forKey: .page) goToPage = try c.decode(String.self, forKey: .goToPage) go = try c.decode(String.self, forKey: .go) pinPress = try c.decode(String.self, forKey: .pinPress) pinHint = try c.decode(String.self, forKey: .pinHint) pinPlaceholder = try c.decode(String.self, forKey: .pinPlaceholder) cancel = try c.decode(String.self, forKey: .cancel) save = try c.decode(String.self, forKey: .save) saving = try c.decode(String.self, forKey: .saving) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(close, forKey: .close) try c.encode(details, forKey: .details) try c.encode(more, forKey: .more) try c.encode(share, forKey: .share) try c.encode(position, forKey: .position) try c.encode(absent, forKey: .absent) try c.encode(removed, forKey: .removed) try c.encode(fetch, forKey: .fetch) try c.encode(fetching, forKey: .fetching) try c.encode(mapAbsent, forKey: .mapAbsent) try c.encode(play, forKey: .play) try c.encode(pause, forKey: .pause) try c.encode(mute, forKey: .mute) try c.encode(unmute, forKey: .unmute) try c.encode(pictureInPicture, forKey: .pictureInPicture) try c.encode(search, forKey: .search) try c.encode(noMatch, forKey: .noMatch) try c.encode(page, forKey: .page) try c.encode(goToPage, forKey: .goToPage) try c.encode(go, forKey: .go) try c.encode(pinPress, forKey: .pinPress) try c.encode(pinHint, forKey: .pinHint) try c.encode(pinPlaceholder, forKey: .pinPlaceholder) try c.encode(cancel, forKey: .cancel) try c.encode(save, forKey: .save) try c.encode(saving, forKey: .saving) } } /// Storage of cotton_core::definitions::VoiceWords. public struct DefinitionVoiceWords: Codable, Hashable, Sendable { public var saved: String public var undo: String public var undone: String public var opened: String public var back: String public var ran: String public var nothing: String public var denied: String public var settings: String public init(_generated: Void, saved: String, undo: String, undone: String, opened: String, back: String, ran: String, nothing: String, denied: String, settings: String) { self.saved = saved self.undo = undo self.undone = undone self.opened = opened self.back = back self.ran = ran self.nothing = nothing self.denied = denied self.settings = settings } public enum CodingKeys: String, CodingKey, CaseIterable { case saved = "saved" case undo = "undo" case undone = "undone" case opened = "opened" case back = "back" case ran = "ran" case nothing = "nothing" case denied = "denied" case settings = "settings" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) saved = try c.decode(String.self, forKey: .saved) undo = try c.decode(String.self, forKey: .undo) undone = try c.decode(String.self, forKey: .undone) opened = try c.decode(String.self, forKey: .opened) back = try c.decode(String.self, forKey: .back) ran = try c.decode(String.self, forKey: .ran) nothing = try c.decode(String.self, forKey: .nothing) denied = try c.decode(String.self, forKey: .denied) settings = try c.decode(String.self, forKey: .settings) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(saved, forKey: .saved) try c.encode(undo, forKey: .undo) try c.encode(undone, forKey: .undone) try c.encode(opened, forKey: .opened) try c.encode(back, forKey: .back) try c.encode(ran, forKey: .ran) try c.encode(nothing, forKey: .nothing) try c.encode(denied, forKey: .denied) try c.encode(settings, forKey: .settings) } } /// Storage of cotton_core::definitions::TableWords. public struct DefinitionTableWords: Codable, Hashable, Sendable { public var couldNotRead: DefinitionCouldNotReadWords? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case couldNotRead = "could_not_read" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) couldNotRead = try c.decodeIfPresent(DefinitionCouldNotReadWords.self, forKey: .couldNotRead) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(couldNotRead, forKey: .couldNotRead) } } /// Storage of cotton_core::definitions::CouldNotReadWords. public struct DefinitionCouldNotReadWords: Codable, Hashable, Sendable { public var busy: String public var tooLong: String public var macAway: String? = nil public var other: String? = nil public var onTheMac: String? = nil public var moving: String? = nil public init(_generated: Void, busy: String, tooLong: String) { self.busy = busy self.tooLong = tooLong } public enum CodingKeys: String, CodingKey, CaseIterable { case busy = "busy" case tooLong = "too_long" case macAway = "mac_away" case other = "other" case onTheMac = "on_the_mac" case moving = "moving" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) busy = try c.decode(String.self, forKey: .busy) tooLong = try c.decode(String.self, forKey: .tooLong) macAway = try c.decodeIfPresent(String.self, forKey: .macAway) other = try c.decodeIfPresent(String.self, forKey: .other) onTheMac = try c.decodeIfPresent(String.self, forKey: .onTheMac) moving = try c.decodeIfPresent(String.self, forKey: .moving) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(busy, forKey: .busy) try c.encode(tooLong, forKey: .tooLong) try c.encodeIfPresent(macAway, forKey: .macAway) try c.encodeIfPresent(other, forKey: .other) try c.encodeIfPresent(onTheMac, forKey: .onTheMac) try c.encodeIfPresent(moving, forKey: .moving) } } /// Storage of cotton_core::definitions::SectionWhen. public struct DefinitionSectionWhen: Codable, Hashable, Sendable { public var column: String public var values: [String]? = nil public var present: Bool? = nil public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case values = "values" case present = "present" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) values = try c.decodeIfPresent([String].self, forKey: .values) present = try c.decodeIfPresent(Bool.self, forKey: .present) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encodeIfPresent(values, forKey: .values) try c.encodeIfPresent(present, forKey: .present) } } /// Storage of cotton_core::definitions::SectionAction. public struct DefinitionSectionAction: Codable, Hashable, Sendable { public var label: String public var sets: [String: RecordValue] = [:] public var delete: Bool = false public var object: String? = nil public var does: DefinitionCommandDoes? = nil public init(_generated: Void, label: String) { self.label = label } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case sets = "sets" case delete = "delete" case object = "object" case does = "does" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) sets = try c.decodeIfPresent([String: RecordValue].self, forKey: .sets) ?? [:] delete = try c.decodeIfPresent(Bool.self, forKey: .delete) ?? false object = try c.decodeIfPresent(String.self, forKey: .object) does = try c.decodeIfPresent(DefinitionCommandDoes.self, forKey: .does) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) if !sets.isEmpty { try c.encode(sets, forKey: .sets) } if delete != false { try c.encode(delete, forKey: .delete) } try c.encodeIfPresent(object, forKey: .object) try c.encodeIfPresent(does, forKey: .does) } } /// Storage of cotton_core::definitions::PageAction. public struct DefinitionPageAction: Codable, Hashable, Sendable { public var label: String public var column: String public var scheme: DefinitionActionScheme public var object: String? = nil public var schemeColumn: String? = nil public var schemes: [String: DefinitionActionScheme]? = nil public init(_generated: Void, label: String, column: String, scheme: DefinitionActionScheme) { self.label = label self.column = column self.scheme = scheme } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case column = "column" case scheme = "scheme" case object = "object" case schemeColumn = "scheme_column" case schemes = "schemes" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) column = try c.decode(String.self, forKey: .column) scheme = try c.decode(DefinitionActionScheme.self, forKey: .scheme) object = try c.decodeIfPresent(String.self, forKey: .object) schemeColumn = try c.decodeIfPresent(String.self, forKey: .schemeColumn) schemes = try c.decodeIfPresent([String: DefinitionActionScheme].self, forKey: .schemes) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encode(column, forKey: .column) try c.encode(scheme, forKey: .scheme) try c.encodeIfPresent(object, forKey: .object) try c.encodeIfPresent(schemeColumn, forKey: .schemeColumn) try c.encodeIfPresent(schemes, forKey: .schemes) } } /// Storage of cotton_core::definitions::RecordOpens. public struct DefinitionRecordOpens: Codable, Hashable, Sendable { public var column: String public var table: String? = nil public var tableColumn: String? = nil public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case table = "table" case tableColumn = "table_column" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) table = try c.decodeIfPresent(String.self, forKey: .table) tableColumn = try c.decodeIfPresent(String.self, forKey: .tableColumn) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encodeIfPresent(table, forKey: .table) try c.encodeIfPresent(tableColumn, forKey: .tableColumn) } } /// Storage of cotton_core::definitions::ListCapture. public struct DefinitionListCapture: Codable, Hashable, Sendable { public var table: String public var placeholder: String? = nil public var link: String? = nil public var `when`: DefinitionSectionWhen? = nil public var pageOnly: Bool = false public init(_generated: Void, table: String) { self.table = table } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case placeholder = "placeholder" case link = "link" case `when` = "when" case pageOnly = "page_only" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) placeholder = try c.decodeIfPresent(String.self, forKey: .placeholder) link = try c.decodeIfPresent(String.self, forKey: .link) `when` = try c.decodeIfPresent(DefinitionSectionWhen.self, forKey: .`when`) pageOnly = try c.decodeIfPresent(Bool.self, forKey: .pageOnly) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encodeIfPresent(placeholder, forKey: .placeholder) try c.encodeIfPresent(link, forKey: .link) try c.encodeIfPresent(`when`, forKey: .`when`) if pageOnly != false { try c.encode(pageOnly, forKey: .pageOnly) } } } /// Storage of cotton_core::definitions::RecordHandOver. public struct DefinitionRecordHandOver: Codable, Hashable, Sendable { public var `when`: DefinitionSectionWhen? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case `when` = "when" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) `when` = try c.decodeIfPresent(DefinitionSectionWhen.self, forKey: .`when`) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(`when`, forKey: .`when`) } } /// Storage of cotton_core::definitions::AttachmentsLayout. public struct DefinitionAttachmentsLayout: Codable, Hashable, Sendable { public var editable: Bool = true public var sources: [DefinitionAttachmentSource] = [.library, .camera] public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case editable = "editable" case sources = "sources" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) editable = try c.decodeIfPresent(Bool.self, forKey: .editable) ?? true sources = try c.decodeIfPresent([DefinitionAttachmentSource].self, forKey: .sources) ?? [.library, .camera] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if editable != true { try c.encode(editable, forKey: .editable) } if sources != [.library, .camera] { try c.encode(sources, forKey: .sources) } } } /// Storage of cotton_core::definitions::RelatedRecords. public struct DefinitionRelatedRecords: Codable, Hashable, Sendable { public var label: String public var table: String public var column: String? = nil public var filter: [String: RecordValue]? = nil public var `new`: Bool? = nil public var archived: Bool? = nil public var open: String? = nil public var title: String? = nil public var empty: DefinitionEmptyWords? = nil public var `when`: [String: RecordValue]? = nil public init(_generated: Void, label: String, table: String) { self.label = label self.table = table } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case table = "table" case column = "column" case filter = "filter" case `new` = "new" case archived = "archived" case open = "open" case title = "title" case empty = "empty" case `when` = "when" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) table = try c.decode(String.self, forKey: .table) column = try c.decodeIfPresent(String.self, forKey: .column) filter = try c.decodeIfPresent([String: RecordValue].self, forKey: .filter) `new` = try c.decodeIfPresent(Bool.self, forKey: .`new`) archived = try c.decodeIfPresent(Bool.self, forKey: .archived) open = try c.decodeIfPresent(String.self, forKey: .open) title = try c.decodeIfPresent(String.self, forKey: .title) empty = try c.decodeIfPresent(DefinitionEmptyWords.self, forKey: .empty) `when` = try c.decodeIfPresent([String: RecordValue].self, forKey: .`when`) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encode(table, forKey: .table) try c.encodeIfPresent(column, forKey: .column) try c.encodeIfPresent(filter, forKey: .filter) try c.encodeIfPresent(`new`, forKey: .`new`) try c.encodeIfPresent(archived, forKey: .archived) try c.encodeIfPresent(open, forKey: .open) try c.encodeIfPresent(title, forKey: .title) try c.encodeIfPresent(empty, forKey: .empty) try c.encodeIfPresent(`when`, forKey: .`when`) } } /// Storage of cotton_core::definitions::AmountSigns. public struct DefinitionAmountSigns: Codable, Hashable, Sendable { public var positive: String public var negative: String public var zero: String? = nil public init(_generated: Void, positive: String, negative: String) { self.positive = positive self.negative = negative } public enum CodingKeys: String, CodingKey, CaseIterable { case positive = "positive" case negative = "negative" case zero = "zero" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) positive = try c.decode(String.self, forKey: .positive) negative = try c.decode(String.self, forKey: .negative) zero = try c.decodeIfPresent(String.self, forKey: .zero) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(positive, forKey: .positive) try c.encode(negative, forKey: .negative) try c.encodeIfPresent(zero, forKey: .zero) } } /// Storage of cotton_core::definitions::ColumnProvenance. public struct DefinitionColumnProvenance: Codable, Hashable, Sendable { public var by: String public var at: String public var since: String? = nil public init(_generated: Void, by: String, at: String) { self.by = by self.at = at } public enum CodingKeys: String, CodingKey, CaseIterable { case by = "by" case at = "at" case since = "since" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) by = try c.decode(String.self, forKey: .by) at = try c.decode(String.self, forKey: .at) since = try c.decodeIfPresent(String.self, forKey: .since) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(by, forKey: .by) try c.encode(at, forKey: .at) try c.encodeIfPresent(since, forKey: .since) } } /// Storage of cotton_core::definitions::ValueMatch. public struct DefinitionValueMatch: Codable, Hashable, Sendable { public var column: String public var values: [String] public init(_generated: Void, column: String, values: [String]) { self.column = column self.values = values } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case values = "values" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) values = try c.decode([String].self, forKey: .values) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(values, forKey: .values) } } /// Storage of cotton_core::definitions::SecretReveal. public struct DefinitionSecretReveal: Codable, Hashable, Sendable { public var once: Bool public var expires: Int public init(_generated: Void, once: Bool, expires: Int) { self.once = once self.expires = expires } public enum CodingKeys: String, CodingKey, CaseIterable { case once = "once" case expires = "expires" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) once = try c.decode(Bool.self, forKey: .once) expires = try c.decode(Int.self, forKey: .expires) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(once, forKey: .once) try c.encode(expires, forKey: .expires) } } /// Storage of cotton_core::definitions::StoriesLayout. public struct DefinitionStoriesLayout: Codable, Hashable, Sendable { public var picture: DefinitionPolaroidLayout public var page: DefinitionPolaroidLayout public var video: DefinitionValueMatch public init(_generated: Void, picture: DefinitionPolaroidLayout, page: DefinitionPolaroidLayout, video: DefinitionValueMatch) { self.picture = picture self.page = page self.video = video } public enum CodingKeys: String, CodingKey, CaseIterable { case picture = "picture" case page = "page" case video = "video" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) picture = try c.decode(DefinitionPolaroidLayout.self, forKey: .picture) page = try c.decode(DefinitionPolaroidLayout.self, forKey: .page) video = try c.decode(DefinitionValueMatch.self, forKey: .video) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(picture, forKey: .picture) try c.encode(page, forKey: .page) try c.encode(video, forKey: .video) } } /// Storage of cotton_core::definitions::SlipStockBy. public struct DefinitionSlipStockBy: Codable, Hashable, Sendable { public var column: String public var values: [String: DefinitionSlipStock] public init(_generated: Void, column: String, values: [String: DefinitionSlipStock]) { self.column = column self.values = values } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case values = "values" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) values = try c.decode([String: DefinitionSlipStock].self, forKey: .values) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(values, forKey: .values) } } /// Storage of cotton_core::definitions::PageSection. public struct DefinitionPageSection: Codable, Hashable, Sendable { public var heading: String? = nil public var above: Bool = false public var columns: [String] = [] public var picture: String? = nil public var web: String? = nil public var list: DefinitionSectionList? = nil public var `when`: DefinitionSectionWhen? = nil public var note: String? = nil public var ink: DefinitionInk? = nil public var hand: DefinitionPageHand? = nil public var answers: DefinitionRecordAnswers? = nil public var actions: [DefinitionSectionAction] = [] public var commands: [String] = [] public var links: DefinitionLinkedSection? = nil public var figure: String? = nil public var role: DefinitionSectionRole? = nil public var sparkline: DefinitionSparkline? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case heading = "heading" case above = "above" case columns = "columns" case picture = "picture" case web = "web" case list = "list" case `when` = "when" case note = "note" case ink = "ink" case hand = "hand" case answers = "answers" case actions = "actions" case commands = "commands" case links = "links" case figure = "figure" case role = "role" case sparkline = "sparkline" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) heading = try c.decodeIfPresent(String.self, forKey: .heading) above = try c.decodeIfPresent(Bool.self, forKey: .above) ?? false columns = try c.decodeIfPresent([String].self, forKey: .columns) ?? [] picture = try c.decodeIfPresent(String.self, forKey: .picture) web = try c.decodeIfPresent(String.self, forKey: .web) list = try c.decodeIfPresent(DefinitionSectionList.self, forKey: .list) `when` = try c.decodeIfPresent(DefinitionSectionWhen.self, forKey: .`when`) note = try c.decodeIfPresent(String.self, forKey: .note) ink = try c.decodeIfPresent(DefinitionInk.self, forKey: .ink) hand = try c.decodeIfPresent(DefinitionPageHand.self, forKey: .hand) answers = try c.decodeIfPresent(DefinitionRecordAnswers.self, forKey: .answers) actions = try c.decodeIfPresent([DefinitionSectionAction].self, forKey: .actions) ?? [] commands = try c.decodeIfPresent([String].self, forKey: .commands) ?? [] links = try c.decodeIfPresent(DefinitionLinkedSection.self, forKey: .links) figure = try c.decodeIfPresent(String.self, forKey: .figure) role = try c.decodeIfPresent(DefinitionSectionRole.self, forKey: .role) sparkline = try c.decodeIfPresent(DefinitionSparkline.self, forKey: .sparkline) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(heading, forKey: .heading) try c.encode(above, forKey: .above) try c.encode(columns, forKey: .columns) try c.encodeIfPresent(picture, forKey: .picture) try c.encodeIfPresent(web, forKey: .web) try c.encodeIfPresent(list, forKey: .list) try c.encodeIfPresent(`when`, forKey: .`when`) try c.encodeIfPresent(note, forKey: .note) try c.encodeIfPresent(ink, forKey: .ink) try c.encodeIfPresent(hand, forKey: .hand) try c.encodeIfPresent(answers, forKey: .answers) try c.encode(actions, forKey: .actions) try c.encode(commands, forKey: .commands) try c.encodeIfPresent(links, forKey: .links) try c.encodeIfPresent(figure, forKey: .figure) try c.encodeIfPresent(role, forKey: .role) try c.encodeIfPresent(sparkline, forKey: .sparkline) } } /// Storage of cotton_core::definitions::SectionList. public struct DefinitionSectionList: Codable, Hashable, Sendable { public var table: String public var link: String? = nil public var emptyWords: DefinitionSectionEmpty? = nil public var face: DefinitionSectionFace = .slip public var archived: Bool = false public var limit: Int? = nil public var columns: Int? = nil public var with: [DefinitionSectionLink] = [] public var add: String? = nil public var `where`: [String: RecordValue] = [:] public var whole: String? = nil public init(_generated: Void, table: String) { self.table = table } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case link = "link" case emptyWords = "empty" case face = "face" case archived = "archived" case limit = "limit" case columns = "columns" case with = "with" case add = "add" case `where` = "where" case whole = "whole" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) link = try c.decodeIfPresent(String.self, forKey: .link) emptyWords = try c.decodeIfPresent(DefinitionSectionEmpty.self, forKey: .emptyWords) face = try c.decodeIfPresent(DefinitionSectionFace.self, forKey: .face) ?? .slip archived = try c.decodeIfPresent(Bool.self, forKey: .archived) ?? false limit = try c.decodeIfPresent(Int.self, forKey: .limit) columns = try c.decodeIfPresent(Int.self, forKey: .columns) with = try c.decodeIfPresent([DefinitionSectionLink].self, forKey: .with) ?? [] add = try c.decodeIfPresent(String.self, forKey: .add) `where` = try c.decodeIfPresent([String: RecordValue].self, forKey: .`where`) ?? [:] whole = try c.decodeIfPresent(String.self, forKey: .whole) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encodeIfPresent(link, forKey: .link) try c.encodeIfPresent(emptyWords, forKey: .emptyWords) if face != .slip { try c.encode(face, forKey: .face) } if archived != false { try c.encode(archived, forKey: .archived) } try c.encodeIfPresent(limit, forKey: .limit) try c.encodeIfPresent(columns, forKey: .columns) if !with.isEmpty { try c.encode(with, forKey: .with) } try c.encodeIfPresent(add, forKey: .add) if !`where`.isEmpty { try c.encode(`where`, forKey: .`where`) } try c.encodeIfPresent(whole, forKey: .whole) } } /// Storage of cotton_core::definitions::SectionEmptyWords. public struct DefinitionSectionEmptyWords: Codable, Hashable, Sendable { public var title: String public var message: String? = nil public init(_generated: Void, title: String) { self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case title = "title" case message = "message" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) title = try c.decode(String.self, forKey: .title) message = try c.decodeIfPresent(String.self, forKey: .message) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(title, forKey: .title) try c.encodeIfPresent(message, forKey: .message) } } /// Storage of cotton_core::definitions::SectionLink. public struct DefinitionSectionLink: Codable, Hashable, Sendable { public var table: String public var link: String public init(_generated: Void, table: String, link: String) { self.table = table self.link = link } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case link = "link" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) link = try c.decode(String.self, forKey: .link) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(link, forKey: .link) } } /// Storage of cotton_core::definitions::LinkedSection. public struct DefinitionLinkedSection: Codable, Hashable, Sendable { public var except: [String] = [] public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case except = "except" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) except = try c.decodeIfPresent([String].self, forKey: .except) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if !except.isEmpty { try c.encode(except, forKey: .except) } } } /// Storage of cotton_core::definitions::RecordAnswers. public struct DefinitionRecordAnswers: Codable, Hashable, Sendable { public var column: String public var values: [String: String] public var `when`: [String] = [] public var leaves: Bool = true public var primary: String? = nil public init(_generated: Void, column: String, values: [String: String]) { self.column = column self.values = values } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case values = "values" case `when` = "when" case leaves = "leaves" case primary = "primary" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) values = try c.decode([String: String].self, forKey: .values) `when` = try c.decodeIfPresent([String].self, forKey: .`when`) ?? [] leaves = try c.decodeIfPresent(Bool.self, forKey: .leaves) ?? true primary = try c.decodeIfPresent(String.self, forKey: .primary) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(values, forKey: .values) if !`when`.isEmpty { try c.encode(`when`, forKey: .`when`) } if leaves != true { try c.encode(leaves, forKey: .leaves) } try c.encodeIfPresent(primary, forKey: .primary) } } /// Storage of cotton_core::definitions::SlipBy. public struct DefinitionSlipBy: Codable, Hashable, Sendable { public var column: String public var slips: [String: DefinitionSlipVariant] public init(_generated: Void, column: String, slips: [String: DefinitionSlipVariant]) { self.column = column self.slips = slips } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case slips = "slips" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) slips = try c.decode([String: DefinitionSlipVariant].self, forKey: .slips) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(slips, forKey: .slips) } } /// Storage of cotton_core::definitions::SlipVariant. public struct DefinitionSlipVariant: Codable, Hashable, Sendable { public var title: String public var subtitle: DefinitionSlipSubtitle? = nil public var trailing: String? = nil public var caption: DefinitionSlipCaption? = nil public init(_generated: Void, title: String) { self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case title = "title" case subtitle = "subtitle" case trailing = "trailing" case caption = "caption" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) title = try c.decode(String.self, forKey: .title) subtitle = try c.decodeIfPresent(DefinitionSlipSubtitle.self, forKey: .subtitle) trailing = try c.decodeIfPresent(String.self, forKey: .trailing) caption = try c.decodeIfPresent(DefinitionSlipCaption.self, forKey: .caption) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(title, forKey: .title) try c.encodeIfPresent(subtitle, forKey: .subtitle) try c.encodeIfPresent(trailing, forKey: .trailing) try c.encodeIfPresent(caption, forKey: .caption) } } /// Storage of cotton_core::definitions::SlipCaption. public struct DefinitionSlipCaption: Codable, Hashable, Sendable { public var columns: [String] = [] public var status: String? = nil public var dates: [String] = [] public var fields: [String]? = nil public var near: Int? = nil public var dateForm: String? = nil public var form: DefinitionForm? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case columns = "columns" case status = "status" case dates = "dates" case fields = "fields" case near = "near" case dateForm = "date_form" case form = "form" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) columns = try c.decodeIfPresent([String].self, forKey: .columns) ?? [] status = try c.decodeIfPresent(String.self, forKey: .status) dates = try c.decodeIfPresent([String].self, forKey: .dates) ?? [] fields = try c.decodeIfPresent([String].self, forKey: .fields) near = try c.decodeIfPresent(Int.self, forKey: .near) dateForm = try c.decodeIfPresent(String.self, forKey: .dateForm) form = try c.decodeIfPresent(DefinitionForm.self, forKey: .form) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if !columns.isEmpty { try c.encode(columns, forKey: .columns) } try c.encodeIfPresent(status, forKey: .status) if !dates.isEmpty { try c.encode(dates, forKey: .dates) } try c.encodeIfPresent(fields, forKey: .fields) try c.encodeIfPresent(near, forKey: .near) try c.encodeIfPresent(dateForm, forKey: .dateForm) try c.encodeIfPresent(form, forKey: .form) } } /// Storage of cotton_core::definitions::SlipBadge. public struct DefinitionSlipBadge: Codable, Hashable, Sendable { public var column: String public var symbol: String public var spoken: String public var values: [String]? = nil public init(_generated: Void, column: String, symbol: String, spoken: String) { self.column = column self.symbol = symbol self.spoken = spoken } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case symbol = "symbol" case spoken = "spoken" case values = "values" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) symbol = try c.decode(String.self, forKey: .symbol) spoken = try c.decode(String.self, forKey: .spoken) values = try c.decodeIfPresent([String].self, forKey: .values) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(symbol, forKey: .symbol) try c.encode(spoken, forKey: .spoken) try c.encodeIfPresent(values, forKey: .values) } } /// Storage of cotton_core::definitions::SlipReply. public struct DefinitionSlipReply: Codable, Hashable, Sendable { public var column: String public var label: String? = nil public var placeholder: String? = nil public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case label = "label" case placeholder = "placeholder" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) label = try c.decodeIfPresent(String.self, forKey: .label) placeholder = try c.decodeIfPresent(String.self, forKey: .placeholder) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encodeIfPresent(label, forKey: .label) try c.encodeIfPresent(placeholder, forKey: .placeholder) } } /// Storage of cotton_core::definitions::SlipByline. public struct DefinitionSlipByline: Codable, Hashable, Sendable { public var column: String public var words: [String: String] public var ink: DefinitionInk? = nil public init(_generated: Void, column: String, words: [String: String]) { self.column = column self.words = words } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case words = "words" case ink = "ink" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) words = try c.decode([String: String].self, forKey: .words) ink = try c.decodeIfPresent(DefinitionInk.self, forKey: .ink) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(words, forKey: .words) try c.encodeIfPresent(ink, forKey: .ink) } } /// Storage of cotton_core::definitions::SlipLayout. public struct DefinitionSlipLayout: Codable, Hashable, Sendable { public var title: String public var withNames: Bool? = nil public var stock: DefinitionSlipStock? = nil public var stockBy: DefinitionSlipStockBy? = nil public var subtitleKeys: DefinitionSlipSubtitle? = nil public var trailing: String? = nil public var photo: String? = nil public var toggle: String? = nil public var player: String? = nil public var trailingPicture: String? = nil public var subtitleFirst: Bool? = nil public var object: String? = nil public var titleFallback: String? = nil public var subtitleFallback: String? = nil public var toggleOn: [String]? = nil public var toggleStyle: DefinitionToggleStyle = .check public var caption: DefinitionSlipCaption? = nil public var forms: [String: DefinitionForm]? = nil public var figure: String? = nil public var stub: String? = nil public var byline: DefinitionSlipByline? = nil public var badge: DefinitionSlipBadge? = nil public var ordinal: Bool = false public var answers: DefinitionRecordAnswers? = nil public var unread: String? = nil public var edge: DefinitionSlipEdge? = nil public var dye: String? = nil public var status: String? = nil public var opens: DefinitionSlipOpens? = nil public var links: DefinitionLinkedSection? = nil public var lines: DefinitionSlipLines? = nil public var reply: DefinitionSlipReply? = nil public var photoName: String? = nil public var titleLines: Int? = nil public var tap: String? = nil public init(_generated: Void, title: String) { self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case title = "title" case withNames = "with_names" case stock = "stock" case stockBy = "stock_by" case subtitleKeys = "subtitle" case trailing = "trailing" case photo = "photo" case toggle = "toggle" case player = "player" case trailingPicture = "trailing_picture" case subtitleFirst = "subtitle_first" case object = "object" case titleFallback = "title_fallback" case subtitleFallback = "subtitle_fallback" case toggleOn = "toggle_on" case toggleStyle = "toggle_style" case caption = "caption" case forms = "forms" case figure = "figure" case stub = "stub" case byline = "byline" case badge = "badge" case ordinal = "ordinal" case answers = "answers" case unread = "unread" case edge = "edge" case dye = "dye" case status = "status" case opens = "opens" case links = "links" case lines = "lines" case reply = "reply" case photoName = "photo_name" case titleLines = "title_lines" case tap = "tap" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) title = try c.decode(String.self, forKey: .title) withNames = try c.decodeIfPresent(Bool.self, forKey: .withNames) stock = try c.decodeIfPresent(DefinitionSlipStock.self, forKey: .stock) stockBy = try c.decodeIfPresent(DefinitionSlipStockBy.self, forKey: .stockBy) subtitleKeys = try c.decodeIfPresent(DefinitionSlipSubtitle.self, forKey: .subtitleKeys) trailing = try c.decodeIfPresent(String.self, forKey: .trailing) photo = try c.decodeIfPresent(String.self, forKey: .photo) toggle = try c.decodeIfPresent(String.self, forKey: .toggle) player = try c.decodeIfPresent(String.self, forKey: .player) trailingPicture = try c.decodeIfPresent(String.self, forKey: .trailingPicture) subtitleFirst = try c.decodeIfPresent(Bool.self, forKey: .subtitleFirst) object = try c.decodeIfPresent(String.self, forKey: .object) titleFallback = try c.decodeIfPresent(String.self, forKey: .titleFallback) subtitleFallback = try c.decodeIfPresent(String.self, forKey: .subtitleFallback) toggleOn = try c.decodeIfPresent([String].self, forKey: .toggleOn) toggleStyle = try c.decodeIfPresent(DefinitionToggleStyle.self, forKey: .toggleStyle) ?? .check caption = try c.decodeIfPresent(DefinitionSlipCaption.self, forKey: .caption) forms = try c.decodeIfPresent([String: DefinitionForm].self, forKey: .forms) figure = try c.decodeIfPresent(String.self, forKey: .figure) stub = try c.decodeIfPresent(String.self, forKey: .stub) byline = try c.decodeIfPresent(DefinitionSlipByline.self, forKey: .byline) badge = try c.decodeIfPresent(DefinitionSlipBadge.self, forKey: .badge) ordinal = try c.decodeIfPresent(Bool.self, forKey: .ordinal) ?? false answers = try c.decodeIfPresent(DefinitionRecordAnswers.self, forKey: .answers) unread = try c.decodeIfPresent(String.self, forKey: .unread) edge = try c.decodeIfPresent(DefinitionSlipEdge.self, forKey: .edge) dye = try c.decodeIfPresent(String.self, forKey: .dye) status = try c.decodeIfPresent(String.self, forKey: .status) opens = try c.decodeIfPresent(DefinitionSlipOpens.self, forKey: .opens) links = try c.decodeIfPresent(DefinitionLinkedSection.self, forKey: .links) lines = try c.decodeIfPresent(DefinitionSlipLines.self, forKey: .lines) reply = try c.decodeIfPresent(DefinitionSlipReply.self, forKey: .reply) photoName = try c.decodeIfPresent(String.self, forKey: .photoName) titleLines = try c.decodeIfPresent(Int.self, forKey: .titleLines) tap = try c.decodeIfPresent(String.self, forKey: .tap) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(title, forKey: .title) try c.encodeIfPresent(withNames, forKey: .withNames) try c.encodeIfPresent(stock, forKey: .stock) try c.encodeIfPresent(stockBy, forKey: .stockBy) try c.encodeIfPresent(subtitleKeys, forKey: .subtitleKeys) try c.encodeIfPresent(trailing, forKey: .trailing) try c.encodeIfPresent(photo, forKey: .photo) try c.encodeIfPresent(toggle, forKey: .toggle) try c.encodeIfPresent(player, forKey: .player) try c.encodeIfPresent(trailingPicture, forKey: .trailingPicture) try c.encodeIfPresent(subtitleFirst, forKey: .subtitleFirst) try c.encodeIfPresent(object, forKey: .object) try c.encodeIfPresent(titleFallback, forKey: .titleFallback) try c.encodeIfPresent(subtitleFallback, forKey: .subtitleFallback) try c.encodeIfPresent(toggleOn, forKey: .toggleOn) if toggleStyle != .check { try c.encode(toggleStyle, forKey: .toggleStyle) } try c.encodeIfPresent(caption, forKey: .caption) try c.encodeIfPresent(forms, forKey: .forms) try c.encodeIfPresent(figure, forKey: .figure) try c.encodeIfPresent(stub, forKey: .stub) try c.encodeIfPresent(byline, forKey: .byline) try c.encodeIfPresent(badge, forKey: .badge) if ordinal != false { try c.encode(ordinal, forKey: .ordinal) } try c.encodeIfPresent(answers, forKey: .answers) try c.encodeIfPresent(unread, forKey: .unread) try c.encodeIfPresent(edge, forKey: .edge) try c.encodeIfPresent(dye, forKey: .dye) try c.encodeIfPresent(status, forKey: .status) try c.encodeIfPresent(opens, forKey: .opens) try c.encodeIfPresent(links, forKey: .links) try c.encodeIfPresent(lines, forKey: .lines) try c.encodeIfPresent(reply, forKey: .reply) try c.encodeIfPresent(photoName, forKey: .photoName) try c.encodeIfPresent(titleLines, forKey: .titleLines) try c.encodeIfPresent(tap, forKey: .tap) } } /// Storage of cotton_core::definitions::SlipLines. public struct DefinitionSlipLines: Codable, Hashable, Sendable { public var table: String public var relation: String public var limit: Int? = nil public init(_generated: Void, table: String, relation: String) { self.table = table self.relation = relation } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case relation = "relation" case limit = "limit" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) relation = try c.decode(String.self, forKey: .relation) limit = try c.decodeIfPresent(Int.self, forKey: .limit) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(relation, forKey: .relation) try c.encodeIfPresent(limit, forKey: .limit) } } /// Storage of cotton_core::definitions::TileLayout. public struct DefinitionTileLayout: Codable, Hashable, Sendable { public var face: DefinitionTileFace public var summary: [DefinitionTileSummary] = [] public var current: DefinitionTileCurrent? = nil public var sparkline: DefinitionSparkline? = nil public var chart: DefinitionChartFace? = nil public init(_generated: Void, face: DefinitionTileFace) { self.face = face } public enum CodingKeys: String, CodingKey, CaseIterable { case face = "face" case summary = "summary" case current = "current" case sparkline = "sparkline" case chart = "chart" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) face = try c.decode(DefinitionTileFace.self, forKey: .face) summary = try c.decodeIfPresent([DefinitionTileSummary].self, forKey: .summary) ?? [] current = try c.decodeIfPresent(DefinitionTileCurrent.self, forKey: .current) sparkline = try c.decodeIfPresent(DefinitionSparkline.self, forKey: .sparkline) chart = try c.decodeIfPresent(DefinitionChartFace.self, forKey: .chart) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(face, forKey: .face) if !summary.isEmpty { try c.encode(summary, forKey: .summary) } try c.encodeIfPresent(current, forKey: .current) try c.encodeIfPresent(sparkline, forKey: .sparkline) try c.encodeIfPresent(chart, forKey: .chart) } } /// Storage of cotton_core::definitions::TileCurrent. public struct DefinitionTileCurrent: Codable, Hashable, Sendable { public var column: String public var days: Int public init(_generated: Void, column: String, days: Int) { self.column = column self.days = days } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case days = "days" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) days = try c.decode(Int.self, forKey: .days) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(days, forKey: .days) } } /// Storage of cotton_core::definitions::TileSummary. public struct DefinitionTileSummary: Codable, Hashable, Sendable { public var op: DefinitionSummaryOp public var column: String? = nil public var filter: [String: RecordValue]? = nil public var label: String? = nil public init(_generated: Void, op: DefinitionSummaryOp) { self.op = op } public enum CodingKeys: String, CodingKey, CaseIterable { case op = "op" case column = "column" case filter = "where" case label = "label" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) op = try c.decode(DefinitionSummaryOp.self, forKey: .op) column = try c.decodeIfPresent(String.self, forKey: .column) filter = try c.decodeIfPresent([String: RecordValue].self, forKey: .filter) label = try c.decodeIfPresent(String.self, forKey: .label) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(op, forKey: .op) try c.encodeIfPresent(column, forKey: .column) try c.encodeIfPresent(filter, forKey: .filter) try c.encodeIfPresent(label, forKey: .label) } } /// Storage of cotton_core::definitions::ChartFace. public struct DefinitionChartFace: Codable, Hashable, Sendable { public var kind: DefinitionChartKind public var x: String public var y: String public var by: DefinitionChartPeriod public var hour: String? = nil public var timezone: String? = nil public var periods: Int? = nil public var filter: [String: RecordValue]? = nil public var sign: DefinitionChartSign? = nil public init(_generated: Void, kind: DefinitionChartKind, x: String, y: String, by: DefinitionChartPeriod) { self.kind = kind self.x = x self.y = y self.by = by } public enum CodingKeys: String, CodingKey, CaseIterable { case kind = "kind" case x = "x" case y = "y" case by = "by" case hour = "hour" case timezone = "timezone" case periods = "periods" case filter = "where" case sign = "sign" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) kind = try c.decode(DefinitionChartKind.self, forKey: .kind) x = try c.decode(String.self, forKey: .x) y = try c.decode(String.self, forKey: .y) by = try c.decode(DefinitionChartPeriod.self, forKey: .by) hour = try c.decodeIfPresent(String.self, forKey: .hour) timezone = try c.decodeIfPresent(String.self, forKey: .timezone) periods = try c.decodeIfPresent(Int.self, forKey: .periods) filter = try c.decodeIfPresent([String: RecordValue].self, forKey: .filter) sign = try c.decodeIfPresent(DefinitionChartSign.self, forKey: .sign) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(kind, forKey: .kind) try c.encode(x, forKey: .x) try c.encode(y, forKey: .y) try c.encode(by, forKey: .by) try c.encodeIfPresent(hour, forKey: .hour) try c.encodeIfPresent(timezone, forKey: .timezone) try c.encodeIfPresent(periods, forKey: .periods) try c.encodeIfPresent(filter, forKey: .filter) try c.encodeIfPresent(sign, forKey: .sign) } } /// Storage of cotton_core::definitions::Sparkline. public struct DefinitionSparkline: Codable, Hashable, Sendable { public var table: String public var value: String public var at: String public var days: Int? = nil public var link: String? = nil public init(_generated: Void, table: String, value: String, at: String) { self.table = table self.value = value self.at = at } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case value = "value" case at = "at" case days = "days" case link = "link" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) value = try c.decode(String.self, forKey: .value) at = try c.decode(String.self, forKey: .at) days = try c.decodeIfPresent(Int.self, forKey: .days) link = try c.decodeIfPresent(String.self, forKey: .link) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(value, forKey: .value) try c.encode(at, forKey: .at) try c.encodeIfPresent(days, forKey: .days) try c.encodeIfPresent(link, forKey: .link) } } /// Storage of cotton_core::definitions::ConversationLayout. public struct DefinitionConversationLayout: Codable, Hashable, Sendable { public var table: String public var links: [String] public var body: String public var at: String public var mine: DefinitionValueMatch public var blankBody: String? = nil public var status: String? = nil public var ended: String? = nil public var sends: [String: RecordValue] = [:] public var header: [String] = [] public var footer: DefinitionMessageColumns? = nil public var media: String? = nil public var system: String? = nil public var colorBy: String? = nil public var queue: DefinitionConversationQueue? = nil public var photo: String? = nil public var anchor: String? = nil public var sendGate: DefinitionCanSend = .allowed(true) public var folds: Bool = false public var headerColumns: [String] = [] public var started: DefinitionConversationStarted? = nil public var placeholder: String? = nil public var also: [DefinitionConversationSource] = [] public init(_generated: Void, table: String, links: [String], body: String, at: String, mine: DefinitionValueMatch) { self.table = table self.links = links self.body = body self.at = at self.mine = mine } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case links = "links" case body = "body" case at = "at" case mine = "mine" case blankBody = "blank_body" case status = "status" case ended = "ended" case sends = "sends" case header = "header" case footer = "footer" case media = "media" case system = "system" case colorBy = "color_by" case queue = "queue" case photo = "photo" case anchor = "anchor" case sendGate = "can_send" case folds = "folds" case headerColumns = "header_columns" case started = "started" case placeholder = "placeholder" case also = "also" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) links = try c.decode([String].self, forKey: .links) body = try c.decode(String.self, forKey: .body) at = try c.decode(String.self, forKey: .at) mine = try c.decode(DefinitionValueMatch.self, forKey: .mine) blankBody = try c.decodeIfPresent(String.self, forKey: .blankBody) status = try c.decodeIfPresent(String.self, forKey: .status) ended = try c.decodeIfPresent(String.self, forKey: .ended) sends = try c.decodeIfPresent([String: RecordValue].self, forKey: .sends) ?? [:] header = try c.decodeIfPresent([String].self, forKey: .header) ?? [] footer = try c.decodeIfPresent(DefinitionMessageColumns.self, forKey: .footer) media = try c.decodeIfPresent(String.self, forKey: .media) system = try c.decodeIfPresent(String.self, forKey: .system) colorBy = try c.decodeIfPresent(String.self, forKey: .colorBy) queue = try c.decodeIfPresent(DefinitionConversationQueue.self, forKey: .queue) photo = try c.decodeIfPresent(String.self, forKey: .photo) anchor = try c.decodeIfPresent(String.self, forKey: .anchor) sendGate = try c.decodeIfPresent(DefinitionCanSend.self, forKey: .sendGate) ?? .allowed(true) folds = try c.decodeIfPresent(Bool.self, forKey: .folds) ?? false headerColumns = try c.decodeIfPresent([String].self, forKey: .headerColumns) ?? [] started = try c.decodeIfPresent(DefinitionConversationStarted.self, forKey: .started) placeholder = try c.decodeIfPresent(String.self, forKey: .placeholder) also = try c.decodeIfPresent([DefinitionConversationSource].self, forKey: .also) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(links, forKey: .links) try c.encode(body, forKey: .body) try c.encode(at, forKey: .at) try c.encode(mine, forKey: .mine) try c.encodeIfPresent(blankBody, forKey: .blankBody) try c.encodeIfPresent(status, forKey: .status) try c.encodeIfPresent(ended, forKey: .ended) try c.encode(sends, forKey: .sends) try c.encode(header, forKey: .header) try c.encodeIfPresent(footer, forKey: .footer) try c.encodeIfPresent(media, forKey: .media) try c.encodeIfPresent(system, forKey: .system) try c.encodeIfPresent(colorBy, forKey: .colorBy) try c.encodeIfPresent(queue, forKey: .queue) try c.encodeIfPresent(photo, forKey: .photo) try c.encodeIfPresent(anchor, forKey: .anchor) try c.encode(sendGate, forKey: .sendGate) try c.encode(folds, forKey: .folds) try c.encode(headerColumns, forKey: .headerColumns) try c.encodeIfPresent(started, forKey: .started) try c.encodeIfPresent(placeholder, forKey: .placeholder) try c.encode(also, forKey: .also) } } /// Storage of cotton_core::definitions::ConversationQueue. public struct DefinitionConversationQueue: Codable, Hashable, Sendable { public var link: String public var body: String public init(_generated: Void, link: String, body: String) { self.link = link self.body = body } public enum CodingKeys: String, CodingKey, CaseIterable { case link = "link" case body = "body" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) link = try c.decode(String.self, forKey: .link) body = try c.decode(String.self, forKey: .body) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(link, forKey: .link) try c.encode(body, forKey: .body) } } /// Storage of cotton_core::definitions::ConversationStarted. public struct DefinitionConversationStarted: Codable, Hashable, Sendable { public var at: String public var words: [String] = [] public init(_generated: Void, at: String) { self.at = at } public enum CodingKeys: String, CodingKey, CaseIterable { case at = "at" case words = "words" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) at = try c.decode(String.self, forKey: .at) words = try c.decodeIfPresent([String].self, forKey: .words) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(at, forKey: .at) try c.encode(words, forKey: .words) } } /// Storage of cotton_core::definitions::ConversationSource. public struct DefinitionConversationSource: Codable, Hashable, Sendable { public var table: String public var links: [String] public var body: String? = nil public var at: String public var mine: DefinitionValueMatch? = nil public var face: DefinitionConversationFace = .note public init(_generated: Void, table: String, links: [String], at: String) { self.table = table self.links = links self.at = at } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case links = "links" case body = "body" case at = "at" case mine = "mine" case face = "face" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) links = try c.decode([String].self, forKey: .links) body = try c.decodeIfPresent(String.self, forKey: .body) at = try c.decode(String.self, forKey: .at) mine = try c.decodeIfPresent(DefinitionValueMatch.self, forKey: .mine) face = try c.decodeIfPresent(DefinitionConversationFace.self, forKey: .face) ?? .note } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(links, forKey: .links) try c.encodeIfPresent(body, forKey: .body) try c.encode(at, forKey: .at) try c.encodeIfPresent(mine, forKey: .mine) if face != .note { try c.encode(face, forKey: .face) } } } /// Storage of cotton_core::definitions::Groups. public struct DefinitionGroups: Codable, Hashable, Sendable { public var stack: DefinitionStackFace public var keptIn: DefinitionGroupsKeptIn? = nil public init(_generated: Void, stack: DefinitionStackFace) { self.stack = stack } public enum CodingKeys: String, CodingKey, CaseIterable { case stack = "stack" case keptIn = "kept_in" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) stack = try c.decode(DefinitionStackFace.self, forKey: .stack) keptIn = try c.decodeIfPresent(DefinitionGroupsKeptIn.self, forKey: .keptIn) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(stack, forKey: .stack) try c.encodeIfPresent(keptIn, forKey: .keptIn) } } /// Storage of cotton_core::definitions::GroupsKeptIn. public struct DefinitionGroupsKeptIn: Codable, Hashable, Sendable { public var table: String public var items: String public init(_generated: Void, table: String, items: String) { self.table = table self.items = items } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case items = "items" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) items = try c.decode(String.self, forKey: .items) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(items, forKey: .items) } } /// Storage of cotton_core::definitions::CommandList. public struct DefinitionCommandList: Codable, Hashable, Sendable { public var atLeast: Int public init(_generated: Void, atLeast: Int) { self.atLeast = atLeast } public enum CodingKeys: String, CodingKey, CaseIterable { case atLeast = "at_least" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) atLeast = try c.decode(Int.self, forKey: .atLeast) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(atLeast, forKey: .atLeast) } } /// Storage of cotton_core::definitions::CommandSpoken. public struct DefinitionCommandSpoken: Codable, Hashable, Sendable { public var verbs: [String] public var record: String public var pick: String? = nil public var pickUnsaid: Bool? = nil public var counted: DefinitionSpokenCounted? = nil public init(_generated: Void, verbs: [String], record: String) { self.verbs = verbs self.record = record } public enum CodingKeys: String, CodingKey, CaseIterable { case verbs = "verbs" case record = "record" case pick = "pick" case pickUnsaid = "pick_unsaid" case counted = "counted" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) verbs = try c.decode([String].self, forKey: .verbs) record = try c.decode(String.self, forKey: .record) pick = try c.decodeIfPresent(String.self, forKey: .pick) pickUnsaid = try c.decodeIfPresent(Bool.self, forKey: .pickUnsaid) counted = try c.decodeIfPresent(DefinitionSpokenCounted.self, forKey: .counted) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(verbs, forKey: .verbs) try c.encode(record, forKey: .record) try c.encodeIfPresent(pick, forKey: .pick) try c.encodeIfPresent(pickUnsaid, forKey: .pickUnsaid) try c.encodeIfPresent(counted, forKey: .counted) } } /// Storage of cotton_core::definitions::SpokenCounted. public struct DefinitionSpokenCounted: Codable, Hashable, Sendable { public var argument: String public var absent: [String] = [] public init(_generated: Void, argument: String) { self.argument = argument } public enum CodingKeys: String, CodingKey, CaseIterable { case argument = "argument" case absent = "absent" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) argument = try c.decode(String.self, forKey: .argument) absent = try c.decodeIfPresent([String].self, forKey: .absent) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(argument, forKey: .argument) try c.encode(absent, forKey: .absent) } } /// Storage of cotton_core::definitions::CommandReveal. public struct DefinitionCommandReveal: Codable, Hashable, Sendable { public var answer: String public var title: String public var note: String public var record: String? = nil public init(_generated: Void, answer: String, title: String, note: String) { self.answer = answer self.title = title self.note = note } public enum CodingKeys: String, CodingKey, CaseIterable { case answer = "answer" case title = "title" case note = "note" case record = "record" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) answer = try c.decode(String.self, forKey: .answer) title = try c.decode(String.self, forKey: .title) note = try c.decode(String.self, forKey: .note) record = try c.decodeIfPresent(String.self, forKey: .record) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(answer, forKey: .answer) try c.encode(title, forKey: .title) try c.encode(note, forKey: .note) try c.encodeIfPresent(record, forKey: .record) } } /// Storage of cotton_core::definitions::CommandPick. public struct DefinitionCommandPick: Codable, Hashable, Sendable { public var argument: String public var kind: DefinitionPickKind public var label: String? = nil public var table: String? = nil public var databaseBy: String? = nil public var filter: [String: RecordValue]? = nil public var choicesFrom: String? = nil public var optional: Bool? = nil public var min: Double? = nil public var defaultValue: Double? = nil public var max: Double? = nil public var labels: [String: String]? = nil public var accept: [String]? = nil public init(_generated: Void, argument: String, kind: DefinitionPickKind) { self.argument = argument self.kind = kind } public enum CodingKeys: String, CodingKey, CaseIterable { case argument = "argument" case kind = "kind" case label = "label" case table = "table" case databaseBy = "database_by" case filter = "where" case choicesFrom = "choices_from" case optional = "optional" case min = "min" case defaultValue = "default" case max = "max" case labels = "labels" case accept = "accept" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) argument = try c.decode(String.self, forKey: .argument) kind = try c.decode(DefinitionPickKind.self, forKey: .kind) label = try c.decodeIfPresent(String.self, forKey: .label) table = try c.decodeIfPresent(String.self, forKey: .table) databaseBy = try c.decodeIfPresent(String.self, forKey: .databaseBy) filter = try c.decodeIfPresent([String: RecordValue].self, forKey: .filter) choicesFrom = try c.decodeIfPresent(String.self, forKey: .choicesFrom) optional = try c.decodeIfPresent(Bool.self, forKey: .optional) min = try c.decodeIfPresent(Double.self, forKey: .min) defaultValue = try c.decodeIfPresent(Double.self, forKey: .defaultValue) max = try c.decodeIfPresent(Double.self, forKey: .max) labels = try c.decodeIfPresent([String: String].self, forKey: .labels) accept = try c.decodeIfPresent([String].self, forKey: .accept) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(argument, forKey: .argument) try c.encode(kind, forKey: .kind) try c.encodeIfPresent(label, forKey: .label) try c.encodeIfPresent(table, forKey: .table) try c.encodeIfPresent(databaseBy, forKey: .databaseBy) try c.encodeIfPresent(filter, forKey: .filter) try c.encodeIfPresent(choicesFrom, forKey: .choicesFrom) try c.encodeIfPresent(optional, forKey: .optional) try c.encodeIfPresent(min, forKey: .min) try c.encodeIfPresent(defaultValue, forKey: .defaultValue) try c.encodeIfPresent(max, forKey: .max) try c.encodeIfPresent(labels, forKey: .labels) try c.encodeIfPresent(accept, forKey: .accept) } } /// Storage of cotton_core::definitions::ReachDetail. public struct DefinitionReachDetail: Codable, Hashable, Sendable { public var kind: DefinitionReachKind public var channel: String? = nil public init(_generated: Void, kind: DefinitionReachKind) { self.kind = kind } public enum CodingKeys: String, CodingKey, CaseIterable { case kind = "kind" case channel = "channel" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) kind = try c.decode(DefinitionReachKind.self, forKey: .kind) channel = try c.decodeIfPresent(String.self, forKey: .channel) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(kind, forKey: .kind) try c.encodeIfPresent(channel, forKey: .channel) } } /// Storage of cotton_core::definitions::ToolHome. public struct DefinitionToolHome: Codable, Hashable, Sendable { public var views: [DefinitionToolView] = [] public var name: String public var purpose: String? = nil public var tables: [String] = [] public var key: String? = nil public var icon: String? = nil public var cardStock: DefinitionCardStock? = nil public var route: String? = nil public var figures: [DefinitionToolFigure] = [] public var heldOnly: Bool = false public var server: DefinitionToolServer? = nil public init(_generated: Void, name: String) { self.name = name } public enum CodingKeys: String, CodingKey, CaseIterable { case views = "views" case name = "name" case purpose = "purpose" case tables = "tables" case key = "key" case icon = "icon" case cardStock = "card_stock" case route = "route" case figures = "figures" case heldOnly = "held_only" case server = "server" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) views = try c.decodeIfPresent([DefinitionToolView].self, forKey: .views) ?? [] name = try c.decode(String.self, forKey: .name) purpose = try c.decodeIfPresent(String.self, forKey: .purpose) tables = try c.decodeIfPresent([String].self, forKey: .tables) ?? [] key = try c.decodeIfPresent(String.self, forKey: .key) icon = try c.decodeIfPresent(String.self, forKey: .icon) cardStock = try c.decodeIfPresent(DefinitionCardStock.self, forKey: .cardStock) route = try c.decodeIfPresent(String.self, forKey: .route) figures = try c.decodeIfPresent([DefinitionToolFigure].self, forKey: .figures) ?? [] heldOnly = try c.decodeIfPresent(Bool.self, forKey: .heldOnly) ?? false server = try c.decodeIfPresent(DefinitionToolServer.self, forKey: .server) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if !views.isEmpty { try c.encode(views, forKey: .views) } try c.encode(name, forKey: .name) try c.encodeIfPresent(purpose, forKey: .purpose) if !tables.isEmpty { try c.encode(tables, forKey: .tables) } try c.encodeIfPresent(key, forKey: .key) try c.encodeIfPresent(icon, forKey: .icon) try c.encodeIfPresent(cardStock, forKey: .cardStock) try c.encodeIfPresent(route, forKey: .route) if !figures.isEmpty { try c.encode(figures, forKey: .figures) } if heldOnly { try c.encode(heldOnly, forKey: .heldOnly) } try c.encodeIfPresent(server, forKey: .server) } } /// Storage of cotton_core::definitions::ToolFigure. public struct DefinitionToolFigure: Codable, Hashable, Sendable { public var read: String public var one: String? = nil public var many: String public var summary: DefinitionJSONValue? = nil public var formula: DefinitionJSONValue? = nil public var term: Bool = false public init(_generated: Void, read: String, many: String) { self.read = read self.many = many } public enum CodingKeys: String, CodingKey, CaseIterable { case read = "read" case one = "one" case many = "many" case summary = "summary" case formula = "formula" case term = "term" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) read = try c.decode(String.self, forKey: .read) one = try c.decodeIfPresent(String.self, forKey: .one) many = try c.decode(String.self, forKey: .many) summary = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .summary) formula = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .formula) term = try c.decodeIfPresent(Bool.self, forKey: .term) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(read, forKey: .read) try c.encodeIfPresent(one, forKey: .one) try c.encode(many, forKey: .many) try c.encodeIfPresent(summary, forKey: .summary) try c.encodeIfPresent(formula, forKey: .formula) if term { try c.encode(term, forKey: .term) } } } /// Storage of cotton_core::definitions::ToolView. public struct DefinitionToolView: Codable, Hashable, Sendable { public var id: String public var label: String public var visibility: String = "owner" public var isDefault: Bool = false public var read: [String: DefinitionJSONValue] public var partition: String? = nil public var sort: DefinitionListSort? = nil public var slip: DefinitionSlipLayout? = nil public var tile: DefinitionTileLayout? = nil public var face: String? = nil public var headLine: DefinitionSlipCaption? = nil public var card: DefinitionCardFace? = nil public var lead: String? = nil public var acts: [String] = [] public var head: DefinitionJSONValue? = nil public var listsBefore: Bool = false public var picture: String? = nil public var opened: DefinitionJSONValue? = nil public var current: DefinitionJSONValue? = nil public init(_generated: Void, id: String, label: String, read: [String: DefinitionJSONValue]) { self.id = id self.label = label self.read = read } public enum CodingKeys: String, CodingKey, CaseIterable { case id = "id" case label = "label" case visibility = "visibility" case isDefault = "is_default" case read = "read" case partition = "partition" case sort = "sort" case slip = "slip" case tile = "tile" case face = "face" case headLine = "head_line" case card = "card" case lead = "lead" case acts = "acts" case head = "head" case listsBefore = "lists_before" case picture = "picture" case opened = "opened" case current = "current" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) id = try c.decode(String.self, forKey: .id) label = try c.decode(String.self, forKey: .label) visibility = try c.decodeIfPresent(String.self, forKey: .visibility) ?? "owner" isDefault = try c.decodeIfPresent(Bool.self, forKey: .isDefault) ?? false read = try c.decode([String: DefinitionJSONValue].self, forKey: .read) partition = try c.decodeIfPresent(String.self, forKey: .partition) sort = try c.decodeIfPresent(DefinitionListSort.self, forKey: .sort) slip = try c.decodeIfPresent(DefinitionSlipLayout.self, forKey: .slip) tile = try c.decodeIfPresent(DefinitionTileLayout.self, forKey: .tile) face = try c.decodeIfPresent(String.self, forKey: .face) headLine = try c.decodeIfPresent(DefinitionSlipCaption.self, forKey: .headLine) card = try c.decodeIfPresent(DefinitionCardFace.self, forKey: .card) lead = try c.decodeIfPresent(String.self, forKey: .lead) acts = try c.decodeIfPresent([String].self, forKey: .acts) ?? [] head = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .head) listsBefore = try c.decodeIfPresent(Bool.self, forKey: .listsBefore) ?? false picture = try c.decodeIfPresent(String.self, forKey: .picture) opened = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .opened) current = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .current) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) try c.encode(label, forKey: .label) try c.encode(visibility, forKey: .visibility) try c.encode(isDefault, forKey: .isDefault) try c.encode(read, forKey: .read) try c.encodeIfPresent(partition, forKey: .partition) try c.encodeIfPresent(sort, forKey: .sort) try c.encodeIfPresent(slip, forKey: .slip) try c.encodeIfPresent(tile, forKey: .tile) try c.encodeIfPresent(face, forKey: .face) try c.encodeIfPresent(headLine, forKey: .headLine) try c.encodeIfPresent(card, forKey: .card) try c.encodeIfPresent(lead, forKey: .lead) if !acts.isEmpty { try c.encode(acts, forKey: .acts) } try c.encodeIfPresent(head, forKey: .head) if listsBefore { try c.encode(listsBefore, forKey: .listsBefore) } try c.encodeIfPresent(picture, forKey: .picture) try c.encodeIfPresent(opened, forKey: .opened) try c.encodeIfPresent(current, forKey: .current) } } /// Storage of cotton_core::definitions::CardFace. public struct DefinitionCardFace: Codable, Hashable, Sendable { public var face: DefinitionCardKind public var offers: [DefinitionCardKind] = [] public var faces: [DefinitionFaceByValue] = [] public var fields: [DefinitionCardField] = [] public var corner: [DefinitionCornerFact] = [] public var art: DefinitionCardArt? = nil public var pace: DefinitionPaceInputs? = nil public var pages: [String] = [] public var opens: DefinitionCardOpens? = nil public init(_generated: Void, face: DefinitionCardKind) { self.face = face } public enum CodingKeys: String, CodingKey, CaseIterable { case face = "face" case offers = "offers" case faces = "faces" case fields = "fields" case corner = "corner" case art = "art" case pace = "pace" case pages = "pages" case opens = "opens" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) face = try c.decode(DefinitionCardKind.self, forKey: .face) offers = try c.decodeIfPresent([DefinitionCardKind].self, forKey: .offers) ?? [] faces = try c.decodeIfPresent([DefinitionFaceByValue].self, forKey: .faces) ?? [] fields = try c.decodeIfPresent([DefinitionCardField].self, forKey: .fields) ?? [] corner = try c.decodeIfPresent([DefinitionCornerFact].self, forKey: .corner) ?? [] art = try c.decodeIfPresent(DefinitionCardArt.self, forKey: .art) pace = try c.decodeIfPresent(DefinitionPaceInputs.self, forKey: .pace) pages = try c.decodeIfPresent([String].self, forKey: .pages) ?? [] opens = try c.decodeIfPresent(DefinitionCardOpens.self, forKey: .opens) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(face, forKey: .face) if !offers.isEmpty { try c.encode(offers, forKey: .offers) } if !faces.isEmpty { try c.encode(faces, forKey: .faces) } if !fields.isEmpty { try c.encode(fields, forKey: .fields) } if !corner.isEmpty { try c.encode(corner, forKey: .corner) } try c.encodeIfPresent(art, forKey: .art) try c.encodeIfPresent(pace, forKey: .pace) if !pages.isEmpty { try c.encode(pages, forKey: .pages) } try c.encodeIfPresent(opens, forKey: .opens) } } /// Storage of cotton_core::definitions::CardField. public struct DefinitionCardField: Codable, Hashable, Sendable { public var slot: DefinitionCardSlot public var column: String? = nil public var only: [String] = [] public var form: DefinitionForm? = nil public var also: [String] = [] public var line: String? = nil public var max: Int? = nil public var label: String? = nil public var at: String? = nil public var chooses: String? = nil public var markdown: Bool = false public init(_generated: Void, slot: DefinitionCardSlot) { self.slot = slot } public enum CodingKeys: String, CodingKey, CaseIterable { case slot = "slot" case column = "column" case only = "only" case form = "form" case also = "also" case line = "line" case max = "max" case label = "label" case at = "at" case chooses = "chooses" case markdown = "markdown" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) slot = try c.decode(DefinitionCardSlot.self, forKey: .slot) column = try c.decodeIfPresent(String.self, forKey: .column) only = try c.decodeIfPresent([String].self, forKey: .only) ?? [] form = try c.decodeIfPresent(DefinitionForm.self, forKey: .form) also = try c.decodeIfPresent([String].self, forKey: .also) ?? [] line = try c.decodeIfPresent(String.self, forKey: .line) max = try c.decodeIfPresent(Int.self, forKey: .max) label = try c.decodeIfPresent(String.self, forKey: .label) at = try c.decodeIfPresent(String.self, forKey: .at) chooses = try c.decodeIfPresent(String.self, forKey: .chooses) markdown = try c.decodeIfPresent(Bool.self, forKey: .markdown) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(slot, forKey: .slot) try c.encodeIfPresent(column, forKey: .column) if !only.isEmpty { try c.encode(only, forKey: .only) } try c.encodeIfPresent(form, forKey: .form) if !also.isEmpty { try c.encode(also, forKey: .also) } try c.encodeIfPresent(line, forKey: .line) try c.encodeIfPresent(max, forKey: .max) try c.encodeIfPresent(label, forKey: .label) try c.encodeIfPresent(at, forKey: .at) try c.encodeIfPresent(chooses, forKey: .chooses) if markdown { try c.encode(markdown, forKey: .markdown) } } } /// Storage of cotton_core::definitions::CornerFact. public struct DefinitionCornerFact: Codable, Hashable, Sendable { public var column: String public var form: DefinitionForm public var within: Int? = nil public var behind: Int? = nil public var line: String? = nil public var done: Bool = false public var ahead: Bool = false public init(_generated: Void, column: String, form: DefinitionForm) { self.column = column self.form = form } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case form = "form" case within = "within" case behind = "behind" case line = "line" case done = "done" case ahead = "ahead" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) form = try c.decode(DefinitionForm.self, forKey: .form) within = try c.decodeIfPresent(Int.self, forKey: .within) behind = try c.decodeIfPresent(Int.self, forKey: .behind) line = try c.decodeIfPresent(String.self, forKey: .line) done = try c.decodeIfPresent(Bool.self, forKey: .done) ?? false ahead = try c.decodeIfPresent(Bool.self, forKey: .ahead) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(form, forKey: .form) try c.encodeIfPresent(within, forKey: .within) try c.encodeIfPresent(behind, forKey: .behind) try c.encodeIfPresent(line, forKey: .line) if done { try c.encode(done, forKey: .done) } if ahead { try c.encode(ahead, forKey: .ahead) } } } /// Storage of cotton_core::definitions::PaceInputs. public struct DefinitionPaceInputs: Codable, Hashable, Sendable { public var date: String public var done: DefinitionValueMatch public var `repeat`: String? = nil public init(_generated: Void, date: String, done: DefinitionValueMatch) { self.date = date self.done = done } public enum CodingKeys: String, CodingKey, CaseIterable { case date = "date" case done = "done" case `repeat` = "repeat" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) date = try c.decode(String.self, forKey: .date) done = try c.decode(DefinitionValueMatch.self, forKey: .done) `repeat` = try c.decodeIfPresent(String.self, forKey: .`repeat`) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(date, forKey: .date) try c.encode(done, forKey: .done) try c.encodeIfPresent(`repeat`, forKey: .`repeat`) } } /// Storage of cotton_core::definitions::CardOpens. public struct DefinitionCardOpens: Codable, Hashable, Sendable { public var table: String public var by: String public var order: [String] = [] public var through: String? = nil public var `when`: DefinitionValueMatch? = nil public init(_generated: Void, table: String, by: String) { self.table = table self.by = by } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case by = "by" case order = "order" case through = "through" case `when` = "when" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) by = try c.decode(String.self, forKey: .by) order = try c.decodeIfPresent([String].self, forKey: .order) ?? [] through = try c.decodeIfPresent(String.self, forKey: .through) `when` = try c.decodeIfPresent(DefinitionValueMatch.self, forKey: .`when`) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(by, forKey: .by) if !order.isEmpty { try c.encode(order, forKey: .order) } try c.encodeIfPresent(through, forKey: .through) try c.encodeIfPresent(`when`, forKey: .`when`) } } /// Storage of cotton_core::definitions::FaceByValue. public struct DefinitionFaceByValue: Codable, Hashable, Sendable { public var `when`: DefinitionValueMatch public var face: DefinitionCardKind public init(_generated: Void, `when`: DefinitionValueMatch, face: DefinitionCardKind) { self.`when` = `when` self.face = face } public enum CodingKeys: String, CodingKey, CaseIterable { case `when` = "when" case face = "face" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) `when` = try c.decode(DefinitionValueMatch.self, forKey: .`when`) face = try c.decode(DefinitionCardKind.self, forKey: .face) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(`when`, forKey: .`when`) try c.encode(face, forKey: .face) } } /// Storage of cotton_core::definitions::Reservation. public struct DefinitionReservation: Codable, Hashable, Sendable { public var slotTable: String public var capacityColumn: String public var claimTable: String public var slotColumn: String public var quantityColumn: String? = nil public init(_generated: Void, slotTable: String, capacityColumn: String, claimTable: String, slotColumn: String) { self.slotTable = slotTable self.capacityColumn = capacityColumn self.claimTable = claimTable self.slotColumn = slotColumn } public enum CodingKeys: String, CodingKey, CaseIterable { case slotTable = "slot_table" case capacityColumn = "capacity_column" case claimTable = "claim_table" case slotColumn = "slot_column" case quantityColumn = "quantity_column" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) slotTable = try c.decode(String.self, forKey: .slotTable) capacityColumn = try c.decode(String.self, forKey: .capacityColumn) claimTable = try c.decode(String.self, forKey: .claimTable) slotColumn = try c.decode(String.self, forKey: .slotColumn) quantityColumn = try c.decodeIfPresent(String.self, forKey: .quantityColumn) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(slotTable, forKey: .slotTable) try c.encode(capacityColumn, forKey: .capacityColumn) try c.encode(claimTable, forKey: .claimTable) try c.encode(slotColumn, forKey: .slotColumn) try c.encodeIfPresent(quantityColumn, forKey: .quantityColumn) } } /// Storage of cotton_core::definitions::ToolDefinition. public struct DefinitionToolDefinition: Codable, Hashable, Sendable { public var views: [DefinitionToolView] = [] public var id: String public var name: String public var purpose: String? = nil public var picture: DefinitionToolPicture? = nil public var cardStock: DefinitionCardStock? = nil public var fanTile: DefinitionJSONValue? = nil public var tables: [String] public var search: [String] = [] public var contributes: [DefinitionToolContribution] = [] public var instructions: String public var automations: [DefinitionJSONValue] public var engines: [String] = [] public var reserve: DefinitionReservation? = nil public var acts: [DefinitionToolAct] = [] public var server: DefinitionToolServer? = nil public var lists: DefinitionToolLists? = nil public var author: DefinitionToolAuthor public var signature: String? = nil public var unknown: [String: DefinitionJSONValue] = [:] public var fallbacks: [String] = [] public var unavailable: [String] = [] public init(_generated: Void, id: String, name: String, tables: [String], instructions: String, automations: [DefinitionJSONValue], author: DefinitionToolAuthor) { self.id = id self.name = name self.tables = tables self.instructions = instructions self.automations = automations self.author = author } public enum CodingKeys: String, CodingKey, CaseIterable { case views = "views" case id = "id" case name = "name" case purpose = "purpose" case picture = "picture" case cardStock = "card_stock" case fanTile = "fan_tile" case tables = "tables" case search = "search" case contributes = "contributes" case instructions = "instructions" case automations = "automations" case engines = "engines" case reserve = "reserve" case acts = "acts" case server = "server" case lists = "lists" case author = "author" case signature = "signature" case fallbacks = "fallbacks" case unavailable = "unavailable" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) views = try c.decodeIfPresent([DefinitionToolView].self, forKey: .views) ?? [] id = try c.decode(String.self, forKey: .id) name = try c.decode(String.self, forKey: .name) purpose = try c.decodeIfPresent(String.self, forKey: .purpose) picture = try c.decodeIfPresent(DefinitionToolPicture.self, forKey: .picture) cardStock = try c.decodeIfPresent(DefinitionCardStock.self, forKey: .cardStock) fanTile = try c.decodeIfPresent(DefinitionJSONValue.self, forKey: .fanTile) tables = try c.decode([String].self, forKey: .tables) search = try c.decodeIfPresent([String].self, forKey: .search) ?? [] contributes = try c.decodeIfPresent([DefinitionToolContribution].self, forKey: .contributes) ?? [] instructions = try c.decode(String.self, forKey: .instructions) automations = try c.decode([DefinitionJSONValue].self, forKey: .automations) engines = try c.decodeIfPresent([String].self, forKey: .engines) ?? [] reserve = try c.decodeIfPresent(DefinitionReservation.self, forKey: .reserve) acts = try c.decodeIfPresent([DefinitionToolAct].self, forKey: .acts) ?? [] server = try c.decodeIfPresent(DefinitionToolServer.self, forKey: .server) lists = try c.decodeIfPresent(DefinitionToolLists.self, forKey: .lists) author = try c.decode(DefinitionToolAuthor.self, forKey: .author) signature = try c.decodeIfPresent(String.self, forKey: .signature) fallbacks = try c.decodeIfPresent([String].self, forKey: .fallbacks) ?? [] unavailable = try c.decodeIfPresent([String].self, forKey: .unavailable) ?? [] let all = try decoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for key in all.allKeys where !known.contains(key.stringValue) { unknown[key.stringValue] = try all.decode(DefinitionJSONValue.self, forKey: key) } } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) if !views.isEmpty { try c.encode(views, forKey: .views) } try c.encode(id, forKey: .id) try c.encode(name, forKey: .name) try c.encodeIfPresent(purpose, forKey: .purpose) try c.encodeIfPresent(picture, forKey: .picture) try c.encodeIfPresent(cardStock, forKey: .cardStock) try c.encodeIfPresent(fanTile, forKey: .fanTile) try c.encode(tables, forKey: .tables) if !search.isEmpty { try c.encode(search, forKey: .search) } if !contributes.isEmpty { try c.encode(contributes, forKey: .contributes) } try c.encode(instructions, forKey: .instructions) try c.encode(automations, forKey: .automations) if !engines.isEmpty { try c.encode(engines, forKey: .engines) } try c.encodeIfPresent(reserve, forKey: .reserve) if !acts.isEmpty { try c.encode(acts, forKey: .acts) } try c.encodeIfPresent(server, forKey: .server) try c.encodeIfPresent(lists, forKey: .lists) try c.encode(author, forKey: .author) try c.encodeIfPresent(signature, forKey: .signature) if !fallbacks.isEmpty { try c.encode(fallbacks, forKey: .fallbacks) } if !unavailable.isEmpty { try c.encode(unavailable, forKey: .unavailable) } var all = encoder.container(keyedBy: DefinitionCodingKey.self) let known = Set(CodingKeys.allCases.map(\.rawValue)) for (key, value) in unknown where !known.contains(key) { try all.encode(value, forKey: DefinitionCodingKey(key)) } } } /// Storage of cotton_core::definitions::ToolContribution. public struct DefinitionToolContribution: Codable, Hashable, Sendable { public var table: String public var column: DefinitionJSONValue public init(_generated: Void, table: String, column: DefinitionJSONValue) { self.table = table self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case column = "column" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) column = try c.decode(DefinitionJSONValue.self, forKey: .column) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(column, forKey: .column) } } /// Storage of cotton_core::definitions::ToolAct. public struct DefinitionToolAct: Codable, Hashable, Sendable { public var id: String public var label: String public var asks: Bool = false public var object: String? = nil public init(_generated: Void, id: String, label: String) { self.id = id self.label = label } public enum CodingKeys: String, CodingKey, CaseIterable { case id = "id" case label = "label" case asks = "asks" case object = "object" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) id = try c.decode(String.self, forKey: .id) label = try c.decode(String.self, forKey: .label) asks = try c.decodeIfPresent(Bool.self, forKey: .asks) ?? false object = try c.decodeIfPresent(String.self, forKey: .object) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) try c.encode(label, forKey: .label) if asks { try c.encode(asks, forKey: .asks) } try c.encodeIfPresent(object, forKey: .object) } } /// Storage of cotton_core::definitions::ToolServer. public struct DefinitionToolServer: Codable, Hashable, Sendable { public var needs: Bool public var line: String public init(_generated: Void, needs: Bool, line: String) { self.needs = needs self.line = line } public enum CodingKeys: String, CodingKey, CaseIterable { case needs = "needs" case line = "line" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) needs = try c.decode(Bool.self, forKey: .needs) line = try c.decode(String.self, forKey: .line) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(needs, forKey: .needs) try c.encode(line, forKey: .line) } } /// Storage of cotton_core::definitions::ToolLists. public struct DefinitionToolLists: Codable, Hashable, Sendable { public var face: DefinitionCardKind public init(_generated: Void, face: DefinitionCardKind) { self.face = face } public enum CodingKeys: String, CodingKey, CaseIterable { case face = "face" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) face = try c.decode(DefinitionCardKind.self, forKey: .face) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(face, forKey: .face) } } /// Storage of cotton_core::definitions::ToolAuthor. public struct DefinitionToolAuthor: Codable, Hashable, Sendable { public var device: String public var name: String public init(_generated: Void, device: String, name: String) { self.device = device self.name = name } public enum CodingKeys: String, CodingKey, CaseIterable { case device = "device" case name = "name" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) device = try c.decode(String.self, forKey: .device) name = try c.decode(String.self, forKey: .name) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(device, forKey: .device) try c.encode(name, forKey: .name) } } /// Storage of cotton_core::definitions::ToolPhoto. public struct DefinitionToolPhoto: Codable, Hashable, Sendable { public var photo: String public var object: String? = nil public var linkObject: DefinitionLinkObject? = nil public init(_generated: Void, photo: String) { self.photo = photo } public enum CodingKeys: String, CodingKey, CaseIterable { case photo = "photo" case object = "object" case linkObject = "link_object" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) photo = try c.decode(String.self, forKey: .photo) object = try c.decodeIfPresent(String.self, forKey: .object) linkObject = try c.decodeIfPresent(DefinitionLinkObject.self, forKey: .linkObject) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(photo, forKey: .photo) try c.encodeIfPresent(object, forKey: .object) try c.encodeIfPresent(linkObject, forKey: .linkObject) } } /// Storage of cotton_core::definitions::LinkPicture. public struct DefinitionLinkPicture: Codable, Hashable, Sendable { public var linkObject: DefinitionLinkObject public init(_generated: Void, linkObject: DefinitionLinkObject) { self.linkObject = linkObject } public enum CodingKeys: String, CodingKey, CaseIterable { case linkObject = "link_object" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) linkObject = try c.decode(DefinitionLinkObject.self, forKey: .linkObject) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(linkObject, forKey: .linkObject) } } /// Storage of cotton_core::definitions::Lookup. public struct DefinitionLookup: Codable, Hashable, Sendable { public var through: String public var column: String public init(_generated: Void, through: String, column: String) { self.through = through self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case through = "through" case column = "column" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) through = try c.decode(String.self, forKey: .through) column = try c.decode(String.self, forKey: .column) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(through, forKey: .through) try c.encode(column, forKey: .column) } } /// Storage of cotton_core::definitions::Rollup. public struct DefinitionRollup: Codable, Hashable, Sendable { public var table: String public var link: String public var op: DefinitionRollupOp public var column: String? = nil public var `where`: DefinitionValueMatch? = nil public var by: String? = nil public init(_generated: Void, table: String, link: String, op: DefinitionRollupOp) { self.table = table self.link = link self.op = op } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case link = "link" case op = "op" case column = "column" case `where` = "where" case by = "by" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) link = try c.decode(String.self, forKey: .link) op = try c.decode(DefinitionRollupOp.self, forKey: .op) column = try c.decodeIfPresent(String.self, forKey: .column) `where` = try c.decodeIfPresent(DefinitionValueMatch.self, forKey: .`where`) by = try c.decodeIfPresent(String.self, forKey: .by) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(link, forKey: .link) try c.encode(op, forKey: .op) try c.encodeIfPresent(column, forKey: .column) try c.encodeIfPresent(`where`, forKey: .`where`) try c.encodeIfPresent(by, forKey: .by) } } /// Storage of cotton_core::definitions::Formula. public struct DefinitionFormula: Codable, Hashable, Sendable { public var op: DefinitionFormulaOp public var of: [String] public var flipWhen: DefinitionValueMatch? = nil public var separator: String? = nil public init(_generated: Void, op: DefinitionFormulaOp, of: [String]) { self.op = op self.of = of } public enum CodingKeys: String, CodingKey, CaseIterable { case op = "op" case of = "of" case flipWhen = "flip_when" case separator = "separator" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) op = try c.decode(DefinitionFormulaOp.self, forKey: .op) of = try c.decode([String].self, forKey: .of) flipWhen = try c.decodeIfPresent(DefinitionValueMatch.self, forKey: .flipWhen) separator = try c.decodeIfPresent(String.self, forKey: .separator) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(op, forKey: .op) try c.encode(of, forKey: .of) try c.encodeIfPresent(flipWhen, forKey: .flipWhen) try c.encodeIfPresent(separator, forKey: .separator) } } /// Storage of cotton_core::definitions::Running. public struct DefinitionRunning: Codable, Hashable, Sendable { public var column: String public var partition: [String] = [] public var opening: DefinitionRunningOpening public var order: String? = nil public var openingLabel: String? = nil public init(_generated: Void, column: String, opening: DefinitionRunningOpening) { self.column = column self.opening = opening } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case partition = "partition" case opening = "opening" case order = "order" case openingLabel = "opening_label" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) partition = try c.decodeIfPresent([String].self, forKey: .partition) ?? [] opening = try c.decode(DefinitionRunningOpening.self, forKey: .opening) order = try c.decodeIfPresent(String.self, forKey: .order) openingLabel = try c.decodeIfPresent(String.self, forKey: .openingLabel) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) if !partition.isEmpty { try c.encode(partition, forKey: .partition) } try c.encode(opening, forKey: .opening) try c.encodeIfPresent(order, forKey: .order) try c.encodeIfPresent(openingLabel, forKey: .openingLabel) } } /// Storage of cotton_core::definitions::Previous. public struct DefinitionPrevious: Codable, Hashable, Sendable { public var column: String public var partition: [String] = [] public init(_generated: Void, column: String) { self.column = column } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case partition = "partition" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) partition = try c.decodeIfPresent([String].self, forKey: .partition) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) if !partition.isEmpty { try c.encode(partition, forKey: .partition) } } } /// Storage of cotton_core::definitions::Activity. public struct DefinitionActivity: Codable, Hashable, Sendable { public var handles: String public var link: String public var op: DefinitionActivityOp public var withinDays: Int? = nil public init(_generated: Void, handles: String, link: String, op: DefinitionActivityOp) { self.handles = handles self.link = link self.op = op } public enum CodingKeys: String, CodingKey, CaseIterable { case handles = "handles" case link = "link" case op = "op" case withinDays = "within_days" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) handles = try c.decode(String.self, forKey: .handles) link = try c.decode(String.self, forKey: .link) op = try c.decode(DefinitionActivityOp.self, forKey: .op) withinDays = try c.decodeIfPresent(Int.self, forKey: .withinDays) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(handles, forKey: .handles) try c.encode(link, forKey: .link) try c.encode(op, forKey: .op) try c.encodeIfPresent(withinDays, forKey: .withinDays) } } /// Storage of cotton_core::definitions::RunningRollup. public struct DefinitionRunningRollup: Codable, Hashable, Sendable { public var rollup: DefinitionRunningAggregate public init(_generated: Void, rollup: DefinitionRunningAggregate) { self.rollup = rollup } public enum CodingKeys: String, CodingKey, CaseIterable { case rollup = "rollup" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) rollup = try c.decode(DefinitionRunningAggregate.self, forKey: .rollup) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(rollup, forKey: .rollup) } } /// Storage of cotton_core::definitions::RunningAggregate. public struct DefinitionRunningAggregate: Codable, Hashable, Sendable { public var table: String public var op: DefinitionRollupOp public var column: String? = nil public var `where`: DefinitionValueMatch? = nil public var by: String? = nil public init(_generated: Void, table: String, op: DefinitionRollupOp) { self.table = table self.op = op } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case op = "op" case column = "column" case `where` = "where" case by = "by" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) op = try c.decode(DefinitionRollupOp.self, forKey: .op) column = try c.decodeIfPresent(String.self, forKey: .column) `where` = try c.decodeIfPresent(DefinitionValueMatch.self, forKey: .`where`) by = try c.decodeIfPresent(String.self, forKey: .by) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(op, forKey: .op) try c.encodeIfPresent(column, forKey: .column) try c.encodeIfPresent(`where`, forKey: .`where`) try c.encodeIfPresent(by, forKey: .by) } } /// Storage of cotton_store::schema::package_tables::PackageTable. public struct DefinitionPackageTable: Codable, Hashable, Sendable { public var name: String public var columns: [DefinitionPackageColumn] public var constraints: [DefinitionLegacyConstraint] = [] public var prefix: String? = nil public var suffix: String? = nil public var indexes: [DefinitionPackageIndex] = [] public var fullText: [DefinitionPackageFullText] = [] public var triggers: [String] = [] public init(_generated: Void, name: String, columns: [DefinitionPackageColumn]) { self.name = name self.columns = columns } public enum CodingKeys: String, CodingKey, CaseIterable { case name = "name" case columns = "columns" case constraints = "constraints" case prefix = "prefix" case suffix = "suffix" case indexes = "indexes" case fullText = "full_text" case triggers = "triggers" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) name = try c.decode(String.self, forKey: .name) columns = try c.decode([DefinitionPackageColumn].self, forKey: .columns) constraints = try c.decodeIfPresent([DefinitionLegacyConstraint].self, forKey: .constraints) ?? [] prefix = try c.decodeIfPresent(String.self, forKey: .prefix) suffix = try c.decodeIfPresent(String.self, forKey: .suffix) indexes = try c.decodeIfPresent([DefinitionPackageIndex].self, forKey: .indexes) ?? [] fullText = try c.decodeIfPresent([DefinitionPackageFullText].self, forKey: .fullText) ?? [] triggers = try c.decodeIfPresent([String].self, forKey: .triggers) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(name, forKey: .name) try c.encode(columns, forKey: .columns) try c.encode(constraints, forKey: .constraints) try c.encodeIfPresent(prefix, forKey: .prefix) try c.encodeIfPresent(suffix, forKey: .suffix) try c.encode(indexes, forKey: .indexes) try c.encode(fullText, forKey: .fullText) try c.encode(triggers, forKey: .triggers) } } /// Storage of cotton_store::schema::package_tables::PackageColumn. public struct DefinitionPackageColumn: Codable, Hashable, Sendable { public var name: String public var `type`: String public var defaultValue: String? = nil public var nullable: Bool = true public var primaryKey: Bool = false public var declaration: String? = nil public var position: Int? = nil public init(_generated: Void, name: String, `type`: String) { self.name = name self.`type` = `type` } public enum CodingKeys: String, CodingKey, CaseIterable { case name = "name" case `type` = "type" case defaultValue = "default" case nullable = "nullable" case primaryKey = "primary_key" case declaration = "declaration" case position = "position" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) name = try c.decode(String.self, forKey: .name) `type` = try c.decode(String.self, forKey: .`type`) defaultValue = try c.decodeIfPresent(String.self, forKey: .defaultValue) nullable = try c.decodeIfPresent(Bool.self, forKey: .nullable) ?? true primaryKey = try c.decodeIfPresent(Bool.self, forKey: .primaryKey) ?? false declaration = try c.decodeIfPresent(String.self, forKey: .declaration) position = try c.decodeIfPresent(Int.self, forKey: .position) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(name, forKey: .name) try c.encode(`type`, forKey: .`type`) try c.encode(defaultValue, forKey: .defaultValue) try c.encode(nullable, forKey: .nullable) try c.encode(primaryKey, forKey: .primaryKey) try c.encodeIfPresent(declaration, forKey: .declaration) try c.encodeIfPresent(position, forKey: .position) } } /// Storage of cotton_store::schema::package_tables::LegacyConstraint. public struct DefinitionLegacyConstraint: Codable, Hashable, Sendable { public var declaration: String public var position: Int public init(_generated: Void, declaration: String, position: Int) { self.declaration = declaration self.position = position } public enum CodingKeys: String, CodingKey, CaseIterable { case declaration = "declaration" case position = "position" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) declaration = try c.decode(String.self, forKey: .declaration) position = try c.decode(Int.self, forKey: .position) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(declaration, forKey: .declaration) try c.encode(position, forKey: .position) } } /// Storage of cotton_store::schema::package_tables::PackageIndex::Declared. public struct DefinitionPackageIndexDeclared: Codable, Hashable, Sendable { public var name: String public var columns: [String] public var unique: Bool = false public init(_generated: Void, name: String, columns: [String]) { self.name = name self.columns = columns } public enum CodingKeys: String, CodingKey, CaseIterable { case name = "name" case columns = "columns" case unique = "unique" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) name = try c.decode(String.self, forKey: .name) columns = try c.decode([String].self, forKey: .columns) unique = try c.decodeIfPresent(Bool.self, forKey: .unique) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(name, forKey: .name) try c.encode(columns, forKey: .columns) try c.encode(unique, forKey: .unique) } } /// Storage of cotton_store::schema::package_tables::PackageFullText::Declared. public struct DefinitionPackageFullTextDeclared: Codable, Hashable, Sendable { public var name: String public var columns: [String] public init(_generated: Void, name: String, columns: [String]) { self.name = name self.columns = columns } public enum CodingKeys: String, CodingKey, CaseIterable { case name = "name" case columns = "columns" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) name = try c.decode(String.self, forKey: .name) columns = try c.decode([String].self, forKey: .columns) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(name, forKey: .name) try c.encode(columns, forKey: .columns) } } /// Storage of cotton_core::definitions::PageParts. public struct DefinitionPageParts: Codable, Hashable, Sendable { public var shape: DefinitionPageShape public var head: DefinitionPartsHead public var links: [String] public var body: String? = nil public var lists: [DefinitionPartsList] public var acts: DefinitionPartsActs public var cards: [DefinitionPartsCard]? = nil public var strip: [DefinitionPartsCard]? = nil public var opens: DefinitionPageOpens? = nil public var groups: [DefinitionPageGroup]? = nil public var views: [DefinitionPageViewRef]? = nil public init(_generated: Void, shape: DefinitionPageShape, head: DefinitionPartsHead, links: [String], lists: [DefinitionPartsList], acts: DefinitionPartsActs) { self.shape = shape self.head = head self.links = links self.lists = lists self.acts = acts } public enum CodingKeys: String, CodingKey, CaseIterable { case shape = "shape" case head = "head" case links = "links" case body = "body" case lists = "lists" case acts = "acts" case cards = "cards" case strip = "strip" case opens = "opens" case groups = "groups" case views = "views" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) shape = try c.decode(DefinitionPageShape.self, forKey: .shape) head = try c.decode(DefinitionPartsHead.self, forKey: .head) links = try c.decode([String].self, forKey: .links) body = try c.decodeIfPresent(String.self, forKey: .body) lists = try c.decode([DefinitionPartsList].self, forKey: .lists) acts = try c.decode(DefinitionPartsActs.self, forKey: .acts) cards = try c.decodeIfPresent([DefinitionPartsCard].self, forKey: .cards) strip = try c.decodeIfPresent([DefinitionPartsCard].self, forKey: .strip) opens = try c.decodeIfPresent(DefinitionPageOpens.self, forKey: .opens) groups = try c.decodeIfPresent([DefinitionPageGroup].self, forKey: .groups) views = try c.decodeIfPresent([DefinitionPageViewRef].self, forKey: .views) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(shape, forKey: .shape) try c.encode(head, forKey: .head) try c.encode(links, forKey: .links) try c.encodeIfPresent(body, forKey: .body) try c.encode(lists, forKey: .lists) try c.encode(acts, forKey: .acts) try c.encodeIfPresent(cards, forKey: .cards) try c.encodeIfPresent(strip, forKey: .strip) try c.encodeIfPresent(opens, forKey: .opens) try c.encodeIfPresent(groups, forKey: .groups) try c.encodeIfPresent(views, forKey: .views) } } /// Storage of cotton_core::definitions::PartsHead. public struct DefinitionPartsHead: Codable, Hashable, Sendable { public var facts: [String] public var state: String? = nil public init(_generated: Void, facts: [String]) { self.facts = facts } public enum CodingKeys: String, CodingKey, CaseIterable { case facts = "facts" case state = "state" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) facts = try c.decode([String].self, forKey: .facts) state = try c.decodeIfPresent(String.self, forKey: .state) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(facts, forKey: .facts) try c.encodeIfPresent(state, forKey: .state) } } /// Storage of cotton_core::definitions::PartsList. public struct DefinitionPartsList: Codable, Hashable, Sendable { public var table: String? = nil public var relation: String? = nil public var matching: DefinitionPartsMatch? = nil public var read: DefinitionPartsRead? = nil public var heading: String? = nil public var mainAct: String? = nil public var face: DefinitionListFace? = nil public var keeps: [String] = [] public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case relation = "relation" case matching = "match" case read = "read" case heading = "heading" case mainAct = "main_act" case face = "face" case keeps = "keeps" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decodeIfPresent(String.self, forKey: .table) relation = try c.decodeIfPresent(String.self, forKey: .relation) matching = try c.decodeIfPresent(DefinitionPartsMatch.self, forKey: .matching) read = try c.decodeIfPresent(DefinitionPartsRead.self, forKey: .read) heading = try c.decodeIfPresent(String.self, forKey: .heading) mainAct = try c.decodeIfPresent(String.self, forKey: .mainAct) face = try c.decodeIfPresent(DefinitionListFace.self, forKey: .face) keeps = try c.decodeIfPresent([String].self, forKey: .keeps) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(table, forKey: .table) try c.encodeIfPresent(relation, forKey: .relation) try c.encodeIfPresent(matching, forKey: .matching) try c.encodeIfPresent(read, forKey: .read) try c.encodeIfPresent(heading, forKey: .heading) try c.encodeIfPresent(mainAct, forKey: .mainAct) try c.encodeIfPresent(face, forKey: .face) if !keeps.isEmpty { try c.encode(keeps, forKey: .keeps) } } } /// Storage of cotton_core::definitions::PartsMatch. public struct DefinitionPartsMatch: Codable, Hashable, Sendable { public var column: String public var parent: String public init(_generated: Void, column: String, parent: String) { self.column = column self.parent = parent } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case parent = "parent" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) parent = try c.decode(String.self, forKey: .parent) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(parent, forKey: .parent) } } /// Storage of cotton_core::definitions::PartsRead. public struct DefinitionPartsRead: Codable, Hashable, Sendable { public var name: String public var bindings: [String: String] public var rows: String public var id: String public var title: String public var trailing: String? = nil public var trailingFormat: DefinitionReadFormat? = nil public var line: [DefinitionReadLine]? = nil public init(_generated: Void, name: String, bindings: [String: String], rows: String, id: String, title: String) { self.name = name self.bindings = bindings self.rows = rows self.id = id self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case name = "name" case bindings = "bindings" case rows = "rows" case id = "id" case title = "title" case trailing = "trailing" case trailingFormat = "trailing_format" case line = "line" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) name = try c.decode(String.self, forKey: .name) bindings = try c.decode([String: String].self, forKey: .bindings) rows = try c.decode(String.self, forKey: .rows) id = try c.decode(String.self, forKey: .id) title = try c.decode(String.self, forKey: .title) trailing = try c.decodeIfPresent(String.self, forKey: .trailing) trailingFormat = try c.decodeIfPresent(DefinitionReadFormat.self, forKey: .trailingFormat) line = try c.decodeIfPresent([DefinitionReadLine].self, forKey: .line) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(name, forKey: .name) try c.encode(bindings, forKey: .bindings) try c.encode(rows, forKey: .rows) try c.encode(id, forKey: .id) try c.encode(title, forKey: .title) try c.encodeIfPresent(trailing, forKey: .trailing) try c.encodeIfPresent(trailingFormat, forKey: .trailingFormat) try c.encodeIfPresent(line, forKey: .line) } } /// Storage of cotton_core::definitions::ReadLine. public struct DefinitionReadLine: Codable, Hashable, Sendable { public var field: String public var format: DefinitionReadFormat? = nil public init(_generated: Void, field: String) { self.field = field } public enum CodingKeys: String, CodingKey, CaseIterable { case field = "field" case format = "format" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) field = try c.decode(String.self, forKey: .field) format = try c.decodeIfPresent(DefinitionReadFormat.self, forKey: .format) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(field, forKey: .field) try c.encodeIfPresent(format, forKey: .format) } } /// Storage of cotton_core::definitions::PartsCard. public struct DefinitionPartsCard: Codable, Hashable, Sendable { public var column: String? = nil public var act: String? = nil public var width: DefinitionSlipWidth? = nil public var row: Bool? = nil public var acts: [String]? = nil public var object: String? = nil public var stock: DefinitionCardStock? = nil public var label: String? = nil public var until: String? = nil public var form: DefinitionForm? = nil public var switches: [String]? = nil public var caption: String? = nil public var `when`: DefinitionSectionWhen? = nil public var linkTo: String? = nil public var clearCommand: String? = nil public var pickCommand: String? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case act = "act" case width = "width" case row = "row" case acts = "acts" case object = "object" case stock = "stock" case label = "label" case until = "until" case form = "form" case switches = "switches" case caption = "caption" case `when` = "when" case linkTo = "link_to" case clearCommand = "clear_command" case pickCommand = "pick_command" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decodeIfPresent(String.self, forKey: .column) act = try c.decodeIfPresent(String.self, forKey: .act) width = try c.decodeIfPresent(DefinitionSlipWidth.self, forKey: .width) row = try c.decodeIfPresent(Bool.self, forKey: .row) acts = try c.decodeIfPresent([String].self, forKey: .acts) object = try c.decodeIfPresent(String.self, forKey: .object) stock = try c.decodeIfPresent(DefinitionCardStock.self, forKey: .stock) label = try c.decodeIfPresent(String.self, forKey: .label) until = try c.decodeIfPresent(String.self, forKey: .until) form = try c.decodeIfPresent(DefinitionForm.self, forKey: .form) switches = try c.decodeIfPresent([String].self, forKey: .switches) caption = try c.decodeIfPresent(String.self, forKey: .caption) `when` = try c.decodeIfPresent(DefinitionSectionWhen.self, forKey: .`when`) linkTo = try c.decodeIfPresent(String.self, forKey: .linkTo) clearCommand = try c.decodeIfPresent(String.self, forKey: .clearCommand) pickCommand = try c.decodeIfPresent(String.self, forKey: .pickCommand) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(column, forKey: .column) try c.encodeIfPresent(act, forKey: .act) try c.encodeIfPresent(width, forKey: .width) try c.encodeIfPresent(row, forKey: .row) try c.encodeIfPresent(acts, forKey: .acts) try c.encodeIfPresent(object, forKey: .object) try c.encodeIfPresent(stock, forKey: .stock) try c.encodeIfPresent(label, forKey: .label) try c.encodeIfPresent(until, forKey: .until) try c.encodeIfPresent(form, forKey: .form) try c.encodeIfPresent(switches, forKey: .switches) try c.encodeIfPresent(caption, forKey: .caption) try c.encodeIfPresent(`when`, forKey: .`when`) try c.encodeIfPresent(linkTo, forKey: .linkTo) try c.encodeIfPresent(clearCommand, forKey: .clearCommand) try c.encodeIfPresent(pickCommand, forKey: .pickCommand) } } /// Storage of cotton_core::definitions::PartsActs. public struct DefinitionPartsActs: Codable, Hashable, Sendable { public var main: String? = nil public var more: [String] public var away: String? = nil public init(_generated: Void, more: [String]) { self.more = more } public enum CodingKeys: String, CodingKey, CaseIterable { case main = "main" case more = "more" case away = "away" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) main = try c.decodeIfPresent(String.self, forKey: .main) more = try c.decode([String].self, forKey: .more) away = try c.decodeIfPresent(String.self, forKey: .away) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(main, forKey: .main) try c.encode(more, forKey: .more) try c.encodeIfPresent(away, forKey: .away) } } /// Storage of cotton_core::definitions::SlipsLayout. public struct DefinitionSlipsLayout: Codable, Hashable, Sendable { public var widths: [String: DefinitionSlipWidth] public var acts: [String: [String]] public var words: [String: String] public var objects: [String: String] = [:] public var listRows: Int? = nil public init(_generated: Void, widths: [String: DefinitionSlipWidth], acts: [String: [String]], words: [String: String]) { self.widths = widths self.acts = acts self.words = words } public enum CodingKeys: String, CodingKey, CaseIterable { case widths = "widths" case acts = "acts" case words = "words" case objects = "objects" case listRows = "list_rows" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) widths = try c.decode([String: DefinitionSlipWidth].self, forKey: .widths) acts = try c.decode([String: [String]].self, forKey: .acts) words = try c.decode([String: String].self, forKey: .words) objects = try c.decodeIfPresent([String: String].self, forKey: .objects) ?? [:] listRows = try c.decodeIfPresent(Int.self, forKey: .listRows) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(widths, forKey: .widths) try c.encode(acts, forKey: .acts) try c.encode(words, forKey: .words) try c.encode(objects, forKey: .objects) try c.encodeIfPresent(listRows, forKey: .listRows) } } /// Storage of cotton_core::definitions::GroupColumns. public struct DefinitionGroupColumns: Codable, Hashable, Sendable { public var columns: [String] public var invites: [String] = [] public init(_generated: Void, columns: [String]) { self.columns = columns } public enum CodingKeys: String, CodingKey, CaseIterable { case columns = "columns" case invites = "invites" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) columns = try c.decode([String].self, forKey: .columns) invites = try c.decodeIfPresent([String].self, forKey: .invites) ?? [] } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(columns, forKey: .columns) if !invites.isEmpty { try c.encode(invites, forKey: .invites) } } } /// Storage of cotton_core::definitions::GroupReads. public struct DefinitionGroupReads: Codable, Hashable, Sendable { public var column: String public var reads: Bool public var folded: Bool = false public init(_generated: Void, column: String, reads: Bool) { self.column = column self.reads = reads } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case reads = "reads" case folded = "folded" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) reads = try c.decode(Bool.self, forKey: .reads) folded = try c.decodeIfPresent(Bool.self, forKey: .folded) ?? false } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(reads, forKey: .reads) if folded { try c.encode(folded, forKey: .folded) } } } /// Storage of cotton_core::definitions::GroupReach. public struct DefinitionGroupReach: Codable, Hashable, Sendable { public var reach: Bool public init(_generated: Void, reach: Bool) { self.reach = reach } public enum CodingKeys: String, CodingKey, CaseIterable { case reach = "reach" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) reach = try c.decode(Bool.self, forKey: .reach) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(reach, forKey: .reach) } } /// Storage of cotton_core::definitions::PageViewRef. public struct DefinitionPageViewRef: Codable, Hashable, Sendable { public var view: String? = nil public var list: String? = nil public var peek: Int? = nil public init(_generated: Void) { } public enum CodingKeys: String, CodingKey, CaseIterable { case view = "view" case list = "list" case peek = "peek" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) view = try c.decodeIfPresent(String.self, forKey: .view) list = try c.decodeIfPresent(String.self, forKey: .list) peek = try c.decodeIfPresent(Int.self, forKey: .peek) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(view, forKey: .view) try c.encodeIfPresent(list, forKey: .list) try c.encodeIfPresent(peek, forKey: .peek) } } /// Storage of cotton_core::records::page::RecordPage. public struct DefinitionRecordPage: Codable, Hashable, Sendable { public var table: String public var id: String public var shape: DefinitionPageShape public var colour: String public var head: DefinitionPageHead public var links: [DefinitionPageLink] public var body: DefinitionPageBody? = nil public var lists: [DefinitionPageList] public var acts: DefinitionPageActs public init(_generated: Void, table: String, id: String, shape: DefinitionPageShape, colour: String, head: DefinitionPageHead, links: [DefinitionPageLink], lists: [DefinitionPageList], acts: DefinitionPageActs) { self.table = table self.id = id self.shape = shape self.colour = colour self.head = head self.links = links self.lists = lists self.acts = acts } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case id = "id" case shape = "shape" case colour = "colour" case head = "head" case links = "links" case body = "body" case lists = "lists" case acts = "acts" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) id = try c.decode(String.self, forKey: .id) shape = try c.decode(DefinitionPageShape.self, forKey: .shape) colour = try c.decode(String.self, forKey: .colour) head = try c.decode(DefinitionPageHead.self, forKey: .head) links = try c.decode([DefinitionPageLink].self, forKey: .links) body = try c.decodeIfPresent(DefinitionPageBody.self, forKey: .body) lists = try c.decode([DefinitionPageList].self, forKey: .lists) acts = try c.decode(DefinitionPageActs.self, forKey: .acts) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(id, forKey: .id) try c.encode(shape, forKey: .shape) try c.encode(colour, forKey: .colour) try c.encode(head, forKey: .head) try c.encode(links, forKey: .links) try c.encodeIfPresent(body, forKey: .body) try c.encode(lists, forKey: .lists) try c.encode(acts, forKey: .acts) } } /// Storage of cotton_core::records::page::PageHead. public struct DefinitionPageHead: Codable, Hashable, Sendable { public var title: String public var facts: String public var state: DefinitionPageState? = nil public init(_generated: Void, title: String, facts: String) { self.title = title self.facts = facts } public enum CodingKeys: String, CodingKey, CaseIterable { case title = "title" case facts = "facts" case state = "state" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) title = try c.decode(String.self, forKey: .title) facts = try c.decode(String.self, forKey: .facts) state = try c.decodeIfPresent(DefinitionPageState.self, forKey: .state) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(title, forKey: .title) try c.encode(facts, forKey: .facts) try c.encodeIfPresent(state, forKey: .state) } } /// Storage of cotton_core::records::page::PageState. public struct DefinitionPageState: Codable, Hashable, Sendable { public var label: String public var tone: String public init(_generated: Void, label: String, tone: String) { self.label = label self.tone = tone } public enum CodingKeys: String, CodingKey, CaseIterable { case label = "label" case tone = "tone" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) label = try c.decode(String.self, forKey: .label) tone = try c.decode(String.self, forKey: .tone) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(label, forKey: .label) try c.encode(tone, forKey: .tone) } } /// Storage of cotton_core::records::page::PageLink. public struct DefinitionPageLink: Codable, Hashable, Sendable { public var table: String public var id: String public var title: String public var printKey: String? = nil public init(_generated: Void, table: String, id: String, title: String) { self.table = table self.id = id self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case id = "id" case title = "title" case printKey = "printKey" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) id = try c.decode(String.self, forKey: .id) title = try c.decode(String.self, forKey: .title) printKey = try c.decodeIfPresent(String.self, forKey: .printKey) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(id, forKey: .id) try c.encode(title, forKey: .title) try c.encodeIfPresent(printKey, forKey: .printKey) } } /// Storage of cotton_core::records::page::PageBody. public struct DefinitionPageBody: Codable, Hashable, Sendable { public var column: String public var text: String public init(_generated: Void, column: String, text: String) { self.column = column self.text = text } public enum CodingKeys: String, CodingKey, CaseIterable { case column = "column" case text = "text" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) column = try c.decode(String.self, forKey: .column) text = try c.decode(String.self, forKey: .text) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(column, forKey: .column) try c.encode(text, forKey: .text) } } /// Storage of cotton_core::records::page::PageList. public struct DefinitionPageList: Codable, Hashable, Sendable { public var heading: String public var table: String? = nil public var read: String? = nil public var count: Int public var rows: [DefinitionPageRow] public var all: DefinitionPageListAll public init(_generated: Void, heading: String, count: Int, rows: [DefinitionPageRow], all: DefinitionPageListAll) { self.heading = heading self.count = count self.rows = rows self.all = all } public enum CodingKeys: String, CodingKey, CaseIterable { case heading = "heading" case table = "table" case read = "read" case count = "count" case rows = "rows" case all = "all" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) heading = try c.decode(String.self, forKey: .heading) table = try c.decodeIfPresent(String.self, forKey: .table) read = try c.decodeIfPresent(String.self, forKey: .read) count = try c.decode(Int.self, forKey: .count) rows = try c.decode([DefinitionPageRow].self, forKey: .rows) all = try c.decode(DefinitionPageListAll.self, forKey: .all) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(heading, forKey: .heading) try c.encodeIfPresent(table, forKey: .table) try c.encodeIfPresent(read, forKey: .read) try c.encode(count, forKey: .count) try c.encode(rows, forKey: .rows) try c.encode(all, forKey: .all) } } /// Storage of cotton_core::records::page::PageRow. public struct DefinitionPageRow: Codable, Hashable, Sendable { public var id: String public var title: String public var line: String? = nil public var trailing: String? = nil public var act: DefinitionPageAct? = nil public init(_generated: Void, id: String, title: String) { self.id = id self.title = title } public enum CodingKeys: String, CodingKey, CaseIterable { case id = "id" case title = "title" case line = "line" case trailing = "trailing" case act = "act" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) id = try c.decode(String.self, forKey: .id) title = try c.decode(String.self, forKey: .title) line = try c.decodeIfPresent(String.self, forKey: .line) trailing = try c.decodeIfPresent(String.self, forKey: .trailing) act = try c.decodeIfPresent(DefinitionPageAct.self, forKey: .act) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) try c.encode(title, forKey: .title) try c.encodeIfPresent(line, forKey: .line) try c.encodeIfPresent(trailing, forKey: .trailing) try c.encodeIfPresent(act, forKey: .act) } } /// Storage of cotton_core::records::page::PageActs. public struct DefinitionPageActs: Codable, Hashable, Sendable { public var main: DefinitionPageAct? = nil public var more: [DefinitionPageAct] public var away: DefinitionPageAct? = nil public init(_generated: Void, more: [DefinitionPageAct]) { self.more = more } public enum CodingKeys: String, CodingKey, CaseIterable { case main = "main" case more = "more" case away = "away" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) main = try c.decodeIfPresent(DefinitionPageAct.self, forKey: .main) more = try c.decode([DefinitionPageAct].self, forKey: .more) away = try c.decodeIfPresent(DefinitionPageAct.self, forKey: .away) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encodeIfPresent(main, forKey: .main) try c.encode(more, forKey: .more) try c.encodeIfPresent(away, forKey: .away) } } /// Storage of cotton_core::records::page::PageAct. public struct DefinitionPageAct: Codable, Hashable, Sendable { public var id: String public var label: String public init(_generated: Void, id: String, label: String) { self.id = id self.label = label } public enum CodingKeys: String, CodingKey, CaseIterable { case id = "id" case label = "label" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) id = try c.decode(String.self, forKey: .id) label = try c.decode(String.self, forKey: .label) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) try c.encode(label, forKey: .label) } } /// Storage of cotton_core::records::page::PageListAll::Table. public struct DefinitionPageListAllTable: Codable, Hashable, Sendable { public var table: String public var filter: [String: RecordValue] public init(_generated: Void, table: String, filter: [String: RecordValue]) { self.table = table self.filter = filter } public enum CodingKeys: String, CodingKey, CaseIterable { case table = "table" case filter = "where" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) table = try c.decode(String.self, forKey: .table) filter = try c.decode([String: RecordValue].self, forKey: .filter) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(table, forKey: .table) try c.encode(filter, forKey: .filter) } } /// Storage of cotton_core::records::page::PageListAll::Read. public struct DefinitionPageListAllRead: Codable, Hashable, Sendable { public var read: String public var args: [String: RecordValue] public init(_generated: Void, read: String, args: [String: RecordValue]) { self.read = read self.args = args } public enum CodingKeys: String, CodingKey, CaseIterable { case read = "read" case args = "args" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) read = try c.decode(String.self, forKey: .read) args = try c.decode([String: RecordValue].self, forKey: .args) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(read, forKey: .read) try c.encode(args, forKey: .args) } } /// Storage of cotton_ffi::phone::catalogue::Page. public struct DefinitionPage: Codable, Hashable, Sendable { public var parts: DefinitionPageParts public var pageParts: [DefinitionPagePart] public init(_generated: Void, parts: DefinitionPageParts, pageParts: [DefinitionPagePart]) { self.parts = parts self.pageParts = pageParts } public enum CodingKeys: String, CodingKey, CaseIterable { case parts = "parts" case pageParts = "page_parts" } public init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) parts = try c.decode(DefinitionPageParts.self, forKey: .parts) pageParts = try c.decode([DefinitionPagePart].self, forKey: .pageParts) } public func encode(to encoder: Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(parts, forKey: .parts) try c.encode(pageParts, forKey: .pageParts) } }