//
//  FileInfo.swift
//  KdanAuto
//
//  Created by 朱东勇 on 2023/2/5.
//

import Foundation

extension NSMutableDictionary {
    
    class func fileInfoWith(_ fileName:String, refFilePath:String?, resultPath:String, comparePath:String, objc:AutoTest) -> NSMutableDictionary {
        let dic = NSMutableDictionary.init()
        
        dic.setValue(fileName, forKey: "fileName");
        dic.setValue(resultPath, forKey: "resultPath");
        dic.setValue(comparePath, forKey: "comparePath");
        if nil != refFilePath {
            dic.setValue(refFilePath, forKey: "refFilePath")
        }
        dic.setValue(objc, forKey: "objc");
        
        return dic
    }
    
    func fileName() -> String {
        return self.value(forKey: "fileName") as! String
    }
    
    func resultPath() -> String {
        return self.value(forKey: "resultPath") as! String
    }
    
    func comparePath() -> String {
        return self.value(forKey: "comparePath") as! String
    }
    
    func refFilePath() -> String? {
        if nil == self.value(forKey: "refFilePath") {
            return nil
        }
        
        return self.value(forKey: "refFilePath") as? String
    }
    
    func objc() -> AutoTest {
        return self.value(forKey: "objc") as! AutoTest
    }
}

