aboutsummaryrefslogtreecommitdiff
path: root/Hotline/State/ServerState.swift
blob: 5913bf55ddd45bc9616d0d289d848b87c80ba4c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import SwiftUI

@Observable
class ServerState: Equatable {
  var id: UUID = UUID()
  var selection: ServerNavigationType
  var serverName: String? = nil
//  var serverBanner: NSImage? = nil
//  var bannerBackgroundColor: Color? = nil

  init(selection: ServerNavigationType) {
    self.selection = selection
  }

  static func == (lhs: ServerState, rhs: ServerState) -> Bool {
    return lhs.id == rhs.id
  }
}

enum ServerNavigationType: Identifiable, Hashable, Equatable {
  var id: String {
    switch self {
    case .chat:
      return "Chat"
    case .news:
      return "News"
    case .board:
      return "Board"
    case .files:
      return "Files"
    case .accounts:
      return "Accounts"
    case .user(let userID):
      return String(userID)
    }
  }
  
  case chat
  case news
  case board
  case files
  case accounts
  case user(userID: UInt16)
}