//
//  LKFFilterABT.swift
//  lkfc
//
//  Created by Alexander Holzer on 20.04.25.
//  Copyright © 2025 Alexander Holzer. All rights reserved.
//

import Foundation

public class LKFFilterAbt : LKFFilter {
    let abt: String
    let abtChar: [CChar]
    let abtCharLength: UInt32
    
    public init? (context: LKFContext, abt: String) {
        let abt = abt.trimmingCharacters(in: .whitespaces)
        guard let abtChar = abt.cString(using: .utf8) else {
            return nil
        }
        self.abt = abt
        self.abtChar = abtChar
        self.abtCharLength = UInt32(abt.count)
    }
    
    public override func isIncluded(contact: LKFAufenthalt) -> Bool {
        return contact.findFirstAbtIndex(abtfc: abtChar, len: abtCharLength) != nil
    }
}
