#!/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 = float(config[key]['speedabovefl240'])
            aircraft.RodAboveFL240 = float(config[key]['rodabovefl240'])
            aircraft.SpeedAboveFL100 = float(config[key]['speedabovefl100'])
            aircraft.RodAboveFL100 = float(config[key]['rodabovefl100'])
            aircraft.SpeedBelowFL100 = float(config[key]['speedbelowfl100'])
            aircraft.RodBelowFL100 = float(config[key]['rodbelowfl100'])
            aircraft.SpeedApproach = float(config[key]['speedapproach'])

            self.Aircrafts[aircraft.Icao] = aircraft
