#!/usr/bin/env python

import configparser

from aman.types.PerformanceData import PerformanceData

class AircraftPerformance:
    def __init__(self, filepath : str):
        config = configparser.ConfigParser()
        config.read(filepath)
        self.aircrafts = { }

        # iterate over all entries
        for key in config:
            if 'DEFAULT' == key:
                continue

            aircraft = PerformanceData(key)

            aircraft.speedAboveFL240 = config[key]['speedabovefl240']
            aircraft.rodAboveFL240 = config[key]['rodabovefl240']
            aircraft.speedAboveFL100 = config[key]['speedabovefl100']
            aircraft.rodAboveFL100 = config[key]['rodabovefl100']
            aircraft.speedBelowFL100 = config[key]['speedbelowfl100']
            aircraft.rodBelowFL100 = config[key]['rodbelowfl100']
            aircraft.speedApproach = config[key]['speedapproach']

            self.aircrafts[aircraft.icao] = aircraft
