oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1import Foundation
2
3// Roster's words for who works on a task and where it is (chat_roster.go:
4// rosterAuthor, rosterTone, rosterTrack). They live here, beside the Live
5// Activity, so the app and its widget extension draw a task the same way;
6// EquipoKit re-exports them.
7
8public enum Specialist: String, CaseIterable, Sendable {
9 case coordinator, engineering, copy, research, checks, review, design
10 public init(category: String) { self = Specialist(rawValue: category.lowercased()) ?? .coordinator }
11 public var name: String {
12 switch self {
13 case .coordinator: return String(localized: "specialist.coordinator", bundle: .module)
14 case .engineering: return String(localized: "specialist.engineering", bundle: .module)
15 case .copy: return String(localized: "specialist.copy", bundle: .module)
16 case .research: return String(localized: "specialist.research", bundle: .module)
17 case .checks: return String(localized: "specialist.checks", bundle: .module)
18 case .review: return String(localized: "specialist.review", bundle: .module)
19 case .design: return String(localized: "specialist.design", bundle: .module)
20 }
21 }
22 /// SF Symbols, matching the web's icons (wrench, type, search).
23 public var symbol: String {
24 switch self {
25 case .coordinator: return "sparkle"
26 case .engineering: return "wrench.adjustable"
27 case .copy: return "textformat"
28 case .research: return "magnifyingglass"
29 case .checks: return "checklist.checked"
30 case .review: return "checkmark.shield"
31 case .design: return "paintbrush.pointed"
32 }
33 }
34}
35
36/// Amber waits on you, red only for a failure; indigo (paused) carries on
37/// by itself (paused work, 2026-11-24).
38public enum StageTone: String, Sendable { case positive, warning, negative, paused }
39
40public enum Stage: String, CaseIterable, Sendable {
41 case noted, inProgress = "in_progress", inReview = "in_review", readyToMerge = "ready_to_merge", done
42 public init?(wire: String) {
43 switch wire {
44 case "merging": self = .readyToMerge
45 case "investigated": self = .noted
46 default: self.init(rawValue: wire)
47 }
48 }
49 public var label: String {
50 switch self {
51 case .noted: return String(localized: "stage.noted", bundle: .module)
52 case .inProgress: return String(localized: "stage.in_progress", bundle: .module)
53 case .inReview: return String(localized: "stage.in_review", bundle: .module)
54 case .readyToMerge: return String(localized: "stage.ready_to_merge", bundle: .module)
55 case .done: return String(localized: "stage.done", bundle: .module)
56 }
57 }
58
59 /// chat_roster.go rosterTrack: the five stops, those before `current`
60 /// done, `current` in its tone. An unknown stage sits on the first.
61 public static func track(at current: Stage?, tone: StageTone) -> [TrackStop] {
62 let index = allCases.firstIndex(of: current ?? .noted) ?? 0
63 return allCases.enumerated().map { i, s in
64 TrackStop(stage: s, state: i < index ? .done : i == index ? .current : .todo, tone: i == index ? tone : nil)
65 }
66 }
67}
68
69public enum StopState: Sendable { case done, current, todo }
70public struct TrackStop: Identifiable, Sendable, Equatable {
71 public var stage: Stage
72 public var state: StopState
73 public var tone: StageTone?
74 /// The current stop's words when it is paused, stopped or needs you
75 /// (paused work); nil: the stage's own.
76 public var label: String? = nil
77 public var id: String { stage.rawValue }
78}
79