Caps-Server/Sources/App/Cap.swift

39 lines
543 B
Swift
Raw Permalink Normal View History

2022-05-24 14:47:50 +02:00
import Foundation
struct Cap: Codable {
let id: Int
var name: String
var count: Int
var mainImage: Int
2022-05-27 09:24:48 +02:00
var color: Color?
2022-05-24 14:47:50 +02:00
enum CodingKeys: String, CodingKey {
case id = "i"
case name = "n"
case count = "c"
case mainImage = "m"
2022-05-27 09:24:48 +02:00
case color = "f"
}
struct Color: Codable, Equatable {
let r: Int
let g: Int
let b: Int
2022-05-24 14:47:50 +02:00
}
}
extension Cap: Comparable {
static func < (lhs: Cap, rhs: Cap) -> Bool {
lhs.id < rhs.id
}
}