from typing import Dict
from typing import Any


def build_config(config : Dict[str, Any]) -> Dict[str, str]:
    """Will build the actual config for Jinja2, based on SDK config.
    """
    result = config.copy()
    # Manage the classifier stable/beta
    is_stable = result.pop("is_stable", False)
    if is_stable:
        result["classifier"] = "Development Status :: 5 - Production/Stable"
    else:
        result["classifier"] = "Development Status :: 4 - Beta"
    # Manage the nspkg
    package_name = result["package_name"]
    result["package_nspkg"] = result.pop(
        "package_nspkg",
        package_name[:package_name.rindex('-')]+"-nspkg"
    )
    # ARM?
    result['is_arm'] = result.pop("is_arm", True)

    # Do I need msrestazure for this package?
    result['need_msrestazure'] = result.pop("need_msrestazure", True)

    # Pre-compute some Jinja variable that are complicated to do inside the templates
    package_parts = result["package_nspkg"][:-len('-nspkg')].split('-')
    result['nspkg_names'] = [
        ".".join(package_parts[:i+1])
        for i in range(len(package_parts))
    ]
    result['init_names'] = [
        "/".join(package_parts[:i+1])+"/__init__.py"
        for i in range(len(package_parts))
    ]

    # Return result
    return result