     }
 }
 
-class Building {
+class Building : Object {
     var floors: Int
     let control: Control = Control()
     var elevators = [Elevator]()
 
     init(floors: Int) {
         self.floors = floors
+        super.init()
         print(description())
         elevators.append(Elevator(maxWeight: 1200, maxFloor: self.floors, control: self.control))
         for elevator in elevators {

                floor -= 1
            }
            
            print("elevator: \(id) moving to floor: \(floor) ...")
        }
    }
};

class Control {
    var id: String
    var elevators = [String: Elevator]()
    var requests = [Request]()
    let dispatchQueue: DispatchQueue = DispatchQueue(label: "com.orens.elevator.control")
    
    init() {
        id = UUID().uuidString.lowercased()
    }
    
    func attachElevator(elevator: Elevator) {
        elevators[elevator.id] = elevator
    }

    case Destination
}

class Object {
    var id: String
    
    init() {
        id = UUID().uuidString.lowercased()
    }
    
    func short_id() -> String {
        return id.substring(to: id.index(id.startIndex, offsetBy: 8))
    }
}

class Request : Object {
    var direction: Direction = Direction.Idle
    var floor: Int = 1
    var type: RequestType
    
    init(direction: Direction, floor: Int, type: RequestType) {
        self.direction = direction
        self.floor = floor
        self.type = type
    }
    
    init(floor: Int) {
        self.direction = Direction.GoTo
        self.type = RequestType.Destination
        self.floor = floor
    }
    
    func description() -> String {
        return "<Request id: \(short_id()) type: \(type), direction: \(direction), floor: \(floor)>"
    }
}

class Elevator : Object {
    let velocity: Int = 1     // how many seconds to move 1 floor
    let maxWeight: Double
    let maxFloor: Int
    var state: State = State.Idle
    var weight: Double = 0
    var floor: Int = 1
