//
//  LKFAufenthaltMELScoringData.swift
//  lkfc
//
//  Created by Alexander Holzer on 22.08.18.
//  Copyright © 2018 Alexander Holzer. All rights reserved.
//

import Foundation
@_implementationOnly import LibLKF

public class LKFAufenthaltMELScoringData {
    
    let mel: String
    let date : String
    
    let melzu : Int
    let plk : Int
    let leist: Int
    
    let gruppe: String
    let knoten: String
    let melmelInfo: String
    let melmelPool: String
    let relevant: String
    
    init (mel: LKFAufenthaltMEL) {
        let cline = UnsafeMutablePointer<CChar>.allocate(capacity:256)
        LibLKF.lkf_auf_get_mel_value(mel.aufenthalt.ptr, mel.index, 12, 256, cline)
        self.mel = String(cString:cline)
        LibLKF.lkf_auf_get_mel_value(mel.aufenthalt.ptr, mel.index, 13, 256, cline)
        date = String(cString:cline)
        LibLKF.lkf_auf_get_mel_value(mel.aufenthalt.ptr, mel.index, 3, 256, cline)
        relevant = String(cString:cline)
        LibLKF.lkf_auf_get_mel_value(mel.aufenthalt.ptr, mel.index, 4, 256, cline)
        gruppe = String(cString:cline)
        LibLKF.lkf_auf_get_mel_value(mel.aufenthalt.ptr, mel.index, 5, 256, cline)
        knoten = String(cString:cline)
        LibLKF.lkf_auf_get_mel_value(mel.aufenthalt.ptr, mel.index, 89, 256, cline)
        melmelInfo = String(cString:cline)
        LibLKF.lkf_auf_get_mel_value(mel.aufenthalt.ptr, mel.index, 90, 256, cline)
        melmelPool = String(cString:cline)

        melzu = LibLKF.lkf_auf_get_mel_field(mel.aufenthalt.ptr, mel.index, 0)
        plk = LibLKF.lkf_auf_get_mel_field(mel.aufenthalt.ptr, mel.index, 1)
        leist = LibLKF.lkf_auf_get_mel_field(mel.aufenthalt.ptr, mel.index, 2)
        cline.deallocate()
    }
}
