#!/usr/bin/env python

from aman.types.Inbound import Inbound

class RecedingHorizonWindow:
    def __init__(self, startTime, endTime):
        self.StartTime = startTime
        self.EndTime = endTime
        self.Inbounds = []

    def isInWindow(self, inbound : Inbound):
        for report in self.Inbounds:
            if report.Callsign == inbound.Callsign:
                return True
        return False

    def inbound(self, callsign : str):
        for report in self.Inbounds:
            if report.Callsign == callsign:
                return report
        return None

    def insert(self, inbound : Inbound):
        for i in range(0, len(self.Inbounds)):
            if self.Inbounds[i].Callsign == inbound.Callsign:
                return
        self.Inbounds.append(inbound)

    def remove(self, callsign : str):
        for i in range(0, len(self.Inbounds)):
            if self.Inbounds[i].Callsign == callsign:
                self.Inbounds.pop(i)
                return