from typing import Dict

class Schema:
    def __init__(self, use_case:str, mappings:Dict[str, str]):
        self.use_case = use_case
        self.mappings = mappings
    
    def add_mapping(self, internal:str, external:str):
        if internal not in self.mappings.keys():
            self.mappings[internal] = external
    
    def to_serializable_dict(self) -> Dict:
        return {
            "use_case": self.use_case,
            "mappings": self.mappings
        }
    
    @staticmethod
    def from_serializable_dict(serializable_dict: Dict):
        return Schema(
            serializable_dict["use_case"],
            serializable_dict["mappings"]
        )