from pydantic import BaseModel


def rewrite_input_data(data):

    return {
        item[0]: item[1]
        for item in data.items()
        if not item[1] == "" and item[1] is not None
    }


class BaseModelRegular(BaseModel):

    def __init__(self, **kwargs):
        super().__init__(**rewrite_input_data(kwargs))

    def excluded_dump(self):
        return self.model_dump(exclude_unset=True, exclude_none=True)

    def dump(self):
        return self.model_dump()
