/// A Norg TODO status. public enum TaskStatus: String, CaseIterable, Identifiable, Sendable, Hashable, Codable { case undone = " " case done = "x" case needsInput = "?" case urgent = "!" case recurring = "+" case pending = "-" case onHold = "=" case cancelled = "_" /// Identifier, corresponds to its character. public var id: String { rawValue } /// Creates a TaskStatus based on a UTF-8 character. public init?(marker: Character) { self.init(rawValue: String(marker)) } init?(markerByte byte: UInt8) { switch byte { case UInt8(ascii: " "): self = .undone case UInt8(ascii: "x"): self = .done case UInt8(ascii: "?"): self = .needsInput case UInt8(ascii: "!"): self = .urgent case UInt8(ascii: "+"): self = .recurring case UInt8(ascii: "-"): self = .pending case UInt8(ascii: "="): self = .onHold case UInt8(ascii: "_"): self = .cancelled default: return nil } } }