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

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

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