from datetime import datetime
from typing import Optional

from src.model.db.base_db_model import BaseDBModel


class UserMasterModel(BaseDBModel):
    user_id: Optional[str]
    mail_adr: Optional[str]
    user_nm: Optional[str]
    auth_flg1: Optional[str]
    auth_flg2: Optional[str]
    auth_flg3: Optional[str]
    auth_flg4: Optional[str]
    auth_flg5: Optional[str]
    auth_flg6: Optional[str]
    auth_flg7: Optional[str]
    auth_flg8: Optional[str]
    auth_flg9: Optional[str]
    auth_flg10: Optional[str]
    pwd: Optional[str]
    enabled_flg: Optional[str]
    creater: Optional[str]
    create_date: Optional[datetime]
    updater: Optional[str]
    update_date: Optional[datetime]
    mntuser_flg: Optional[str]

    def is_enable_user(self):
        return self.enabled_flg == 'Y'

    def is_maintenance_user(self):
        return self.mntuser_flg == '1'

    def is_groupware_user(self):
        return self.mntuser_flg == '0' or self.mntuser_flg is None
