# Path: uamobile/parser/base.py
# class UserAgentParser(object):
#     def parse(self, useragent):
#         raise NotImplementedError()


import re
from uamobile.parser.base import UserAgentParser

FOMA_SERIES_4DIGITS_RE = re.compile(r'\d{4}')
FOMA_SERIES_3DIGITS_RE = re.compile(r'(\d{3}i|\d{2}[ABC][23]?)')

DOCOMO_COMMENT_RE = re.compile(r'\((.+?)\)')
DOCOMO_DISPLAY_BYTES_RE = re.compile(r'^W(\d+)H(\d+)$')

DOCOMO_HTML_VERSION_LIST = [
        (re.compile('[DFNP]501i'), '1.0'),
        (re.compile('502i|821i|209i|651|691i|(?:F|N|P|KO)210i|^F671i$'), '2.0'),
        (re.compile('(?:D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V'), '3.0'),
        (re.compile('504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i'), '4.0'),
        (re.compile('eggy|P751v'), '3.2'),
        (re.compile('505i|252i|900i|506i|880i|253i|P213i|901i|700i|851i$|701i|881i|^SA800i$|600i|^L601i$|^M702i(?:S|G)$|^L602i$'), '5.0'),
        (re.compile('902i|702i|851iWM|882i|883i$|^N601i$|^D800iDS$|^P70[34]imyu$'), '6.0'),
        (re.compile('883iES|903i|703i|904i|704i'), '7.0'),
        (re.compile('905i|705i'), '7.1'),
        (re.compile('906i|[01][0-9]A[23]?'), '7.2'),
        ]

def _get_docomo_html_version(model):
    """
    returns supported HTML version like '3.0'.
    if unkwon, return None.
    """
    for pattern, value in DOCOMO_HTML_VERSION_LIST:
        if pattern.search(model):
            return value
    return None


# Path: uamobile/parser/base.py
# class UserAgentParser(object):
#     def parse(self, useragent):
#         raise NotImplementedError()


# Path: uamobile/parser/docomo.py
import re
from uamobile.parser.base import UserAgentParser


FOMA_SERIES_4DIGITS_RE = re.compile(r'\d{4}')
FOMA_SERIES_3DIGITS_RE = re.compile(r'(\d{3}i|\d{2}[ABC][23]?)')

DOCOMO_COMMENT_RE = re.compile(r'\((.+?)\)')
DOCOMO_DISPLAY_BYTES_RE = re.compile(r'^W(\d+)H(\d+)$')

DOCOMO_HTML_VERSION_LIST = [
        (re.compile('[DFNP]501i'), '1.0'),
        (re.compile('502i|821i|209i|651|691i|(?:F|N|P|KO)210i|^F671i$'), '2.0'),
        (re.compile('(?:D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V'), '3.0'),
        (re.compile('504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i'), '4.0'),
        (re.compile('eggy|P751v'), '3.2'),
        (re.compile('505i|252i|900i|506i|880i|253i|P213i|901i|700i|851i$|701i|881i|^SA800i$|600i|^L601i$|^M702i(?:S|G)$|^L602i$'), '5.0'),
        (re.compile('902i|702i|851iWM|882i|883i$|^N601i$|^D800iDS$|^P70[34]imyu$'), '6.0'),
        (re.compile('883iES|903i|703i|904i|704i'), '7.0'),
        (re.compile('905i|705i'), '7.1'),
        (re.compile('906i|[01][0-9]A[23]?'), '7.2'),
        ]

def _get_docomo_html_version(model):
    """
    returns supported HTML version like '3.0'.
    if unkwon, return None.
    """
    for pattern, value in DOCOMO_HTML_VERSION_LIST:
        if pattern.search(model):
            return value
    return None


class DoCoMoUserAgentParser(UserAgentParser):