from typing import Dict
from typing import Any


def from_strings_to_dict(data: Dict[str, Any]):
    """
    Makes a model for a given list of string like :

    "mission.document.name": "test" => {
        mission: {
            document: {
                name: "test"
            }
        }
    }
    """
    res = {}
    for key, value in data.items():
        l = key.split('.')
        previous = []
        end = len(l) - 1
        for i, item in enumerate(l):
            d = res
            for prev in previous[:-1]:
                d = d[prev]

            if len(previous) > 0:
                d = d[previous[-1]]

            if item not in d:
                if i != end:
                    d[item] = {}
                else:
                    d[item] = value
            previous.append(item)
    return res