# Path: ogn/parser/pattern.py
# PATTERN_INREACH_POSITION_COMMENT = re.compile(r"""
#     id(?P<id>[\d]+)\s
#     (?P<model>inReac[A-Za-z\d]*)\s
#     (?P<status>[A-Za-z]+)\s?
#     (?P<pilot_name>.+)?
# """, re.VERBOSE | re.MULTILINE)
# 
# Path: ogn/parser/aprs_comment/base.py
# class BaseParser():
#     def __init__(self):
#         self.beacon_type = 'unknown'
# 
#     def parse(self, aprs_comment, aprs_type):
#         if aprs_type.startswith('position'):
#             data = self.parse_position(aprs_comment)
#         elif aprs_type.startswith('status'):
#             data = self.parse_status(aprs_comment)
#         else:
#             raise ValueError("aprs_type {} unknown".format(aprs_type))
#         data.update({'beacon_type': self.beacon_type})
#         return data
# 
#     def parse_position(self, aprs_comment):
#         raise NotImplementedError("Position parser for parser '{}' not yet implemented".format(self.beacon_type))
# 
#     def parse_status(self, aprs_comment):
#         raise NotImplementedError("Status parser for parser '{}' not yet implemented".format(self.beacon_type))


from ogn.parser.pattern import PATTERN_INREACH_POSITION_COMMENT
from .base import BaseParser



class InreachParser(BaseParser):
    def __init__(self):
        self.beacon_type = 'inreach'
        self.position_pattern = PATTERN_INREACH_POSITION_COMMENT

    def parse_position(self, aprs_comment):
        match = self.position_pattern.match(aprs_comment)
        return {'address': match.group('id'),

# Path: ogn/parser/pattern.py
# PATTERN_INREACH_POSITION_COMMENT = re.compile(r"""
#     id(?P<id>[\d]+)\s
#     (?P<model>inReac[A-Za-z\d]*)\s
#     (?P<status>[A-Za-z]+)\s?
#     (?P<pilot_name>.+)?
# """, re.VERBOSE | re.MULTILINE)
# 
# Path: ogn/parser/aprs_comment/base.py
# class BaseParser():
#     def __init__(self):
#         self.beacon_type = 'unknown'
# 
#     def parse(self, aprs_comment, aprs_type):
#         if aprs_type.startswith('position'):
#             data = self.parse_position(aprs_comment)
#         elif aprs_type.startswith('status'):
#             data = self.parse_status(aprs_comment)
#         else:
#             raise ValueError("aprs_type {} unknown".format(aprs_type))
#         data.update({'beacon_type': self.beacon_type})
#         return data
# 
#     def parse_position(self, aprs_comment):
#         raise NotImplementedError("Position parser for parser '{}' not yet implemented".format(self.beacon_type))
# 
#     def parse_status(self, aprs_comment):
#         raise NotImplementedError("Status parser for parser '{}' not yet implemented".format(self.beacon_type))


# Path: ogn/parser/aprs_comment/inreach_parser.py
from ogn.parser.pattern import PATTERN_INREACH_POSITION_COMMENT
from .base import BaseParser




class InreachParser(BaseParser):
    def __init__(self):
        self.beacon_type = 'inreach'
        self.position_pattern = PATTERN_INREACH_POSITION_COMMENT

    def parse_position(self, aprs_comment):
        match = self.position_pattern.match(aprs_comment)
        return {'address': match.group('id'),

                'model': match.group('model') if match.group('model') else None,