import Foundation
import RealmSwift

enum DebugInfoStatus: Int {
    case success = 0
    case error = 1
    case warning = 2
}

class DebugInfo: Object, Decodable {
    @objc dynamic var autocod: DebugInfoEntry!
    @objc dynamic var vin01vin: DebugInfoEntry!
    @objc dynamic var vin01base: DebugInfoEntry!
    @objc dynamic var vin01history: DebugInfoEntry!
    @objc dynamic var nomerogram: DebugInfoEntry!
}

class DebugInfoEntry: Object, Decodable {
    @objc dynamic var fields: Int64 = 0
    @objc dynamic var error: String?
    @objc dynamic var status: Int = 0
    
    var statusEnum: DebugInfoStatus {
        get { DebugInfoStatus(rawValue: self.status)! }
        set { self.status = newValue.rawValue }
    }
}
