from typing import Optional

from pydantic import BaseModel


class UserViewModel(BaseModel):
    bio_flg: Optional[str]  # AUTH_FLG1
    doc_flg: Optional[str]  # AUTH_FLG2
    inst_flg: Optional[str]  # AUTH_FLG3
    master_mainte_flg: Optional[str]  # AUTH_FLG4
    user_flg: Optional[str]  # MNTUSER_FLG

    def has_ult_doctor_permission(self):
        return self.doc_flg == '1'

    def has_ult_inst_permission(self):
        return self.inst_flg == '1'

    def has_bio_permission(self):
        return self.bio_flg == '1'

    def has_master_maintenance_permission(self):
        return self.master_mainte_flg == '1'
