summaryrefslogtreecommitdiff
path: root/Sora/Data/Booru/BooruRating.swift
blob: 1135adde3df49200460b235ccc3345d78293d889 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
enum BooruRating: String, CaseIterable, Codable {
  case explicit = "Explicit"
  case questionable = "Questionable"
  case safe = "Safe"

  // MARK: - Initialization
  init(_ string: String) {
    self = Self.shortCodeMap[string] ?? .questionable
  }

  // MARK: - Private
  private static let shortCodeMap: [String: Self] = [
    "e": .explicit,
    "s": .safe,
  ]
}