# -*- coding: utf-8 -*-

from django.conf import settings
from versions import Version


def is_version_match(request, vers={}):
    minv, maxv = (vers.get('min_adr', ''), vers.get('max_adr', '')) if request.Android else (vers.get('min_ios', ''), vers.get('max_ios', ''))
    return Version.parse(minv or settings.MIN_VERSION) <= Version.parse(
        request.REQUEST.get('version', settings.CURRENT_VERSION)) <= Version.parse(maxv or settings.MAX_VERSION)
