from typing import Optional

from pydantic import BaseModel


class RequestLogin(BaseModel):
    access_key: str
    password: str
    remember_me: Optional[bool]


class RequestVerifyOTP(BaseModel):
    token: str
    otp: str


class RequestApplication(BaseModel):
    page_url: str  # /building/create


class RequestSelectEmployee(BaseModel):

    company_uu_id: str

    @property
    def is_employee(self):
        return True

    @property
    def is_occupant(self):
        return False


class RequestSelectLiving(BaseModel):

    build_living_space_uu_id: str

    @property
    def is_employee(self):
        return False

    @property
    def is_occupant(self):
        return True


class RequestCreatePassword(BaseModel):
    password_token: str
    password: str
    re_password: str

    @property
    def is_valid(self):
        return self.password == self.re_password


class RequestChangePassword(BaseModel):
    old_password: str
    password: str
    re_password: str

    @property
    def is_valid(self):
        return self.password == self.re_password


class RequestForgotPasswordEmail(BaseModel):
    email: str


class RequestForgotPasswordPhone(BaseModel):
    phone_number: str
