import Foundation
import RealmSwift

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

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

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