//
//  UserParser.swift
//  NearbyStores
//
//  Created by Amine on 5/20/18.
//  Copyright © 2018 Amine. All rights reserved.
//

//
//  JobParser.swift
//  AppTest
//
//  Created by Amine on 5/15/18.
//  Copyright © 2018 Amine. All rights reserved.
//

import UIKit
import SwiftyJSON

class ModulesParser: Parser {
    
    
    func parse() -> [ModuleManager] {
        
        var list = [ModuleManager]()
    
        if let myResult = self.result {
            
                         
            
            if myResult.count > 0 {
                
                let size = myResult.count-1
                
                for index in 0...size {
                    
                    let object = myResult[String(index)]
                  
                
                    let myObject = ModuleManager()
                    
                    myObject.module = object["module_name"].stringValue
                    myObject.enabled = object["enabled"].intValue
                   
                    list.append(myObject)
                    
                }

                
            }
            
            
            return list
        }
        
        return []
    }
    
    
   
    
}



