from pydantic import BaseModel
import typing as t


class UserBase(BaseModel):
    email: str
    is_active: bool = True
    is_superuser: bool = False
    first_name: str = None
    last_name: str = None


class UserOut(UserBase):
    pass


class UserCreate(UserBase):
    password: str

    class Config:
        orm_mode = True


class UserEdit(UserBase):
    password: t.Optional[str] = None

    class Config:
        orm_mode = True


class User(UserBase):
    id: int

    class Config:
        orm_mode = True


class Token(BaseModel):
    access_token: str
    token_type: str


class TokenData(BaseModel):
    email: str = None
    permissions: str = "user"


class AppEdit(BaseModel):
    setting: str = None

class AppBase(BaseModel):
    appid: str
    setting: str = None


class App(AppBase):
    id: int

    class Config:
        orm_mode = True


class Kintone(BaseModel):
    id: int
    type: int
    name: str = None
    desc: str = None
    content: str = None

    class Config:
        orm_mode = True