from datetime import datetime
from typing import Optional

from sqlmodel import Field, Enum, Column
from sqlmodel.main import SQLModel

from graphene_example.app.core.structures import TaskStatusEnum


class User(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    full_name: str
    email: Optional[str]
    hashed_password: str
    is_active: bool = True
    is_superuser: bool = True


class Task(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    created_at: datetime = Field(default=datetime.utcnow)
    title: str
    status: TaskStatusEnum = Field(sa_column=Column(Enum(TaskStatusEnum)), default=TaskStatusEnum.draft)
    user_id: Optional[int] = Field(default=None, foreign_key="user.id")

sqlmodel.Enum sqlmodel.Field
[((260, 297), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'primary_key': '(True)'}), '(default=None, primary_key=True)\n', (265, 297), False, 'from sqlmodel import Field, Enum, Column\n'), ((484, 521), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'primary_key': '(True)'}), '(default=None, primary_key=True)\n', (489, 521), False, 'from sqlmodel import Field, Enum, Column\n'), ((549, 579), 'sqlmodel.Field', 'Field', ([], {'default': 'datetime.utcnow'}), '(default=datetime.utcnow)\n', (554, 579), False, 'from sqlmodel import Field, Enum, Column\n'), ((729, 771), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'foreign_key': '"""user.id"""'}), "(default=None, foreign_key='user.id')\n", (734, 771), False, 'from sqlmodel import Field, Enum, Column\n'), ((647, 667), 'sqlmodel.Enum', 'Enum', (['TaskStatusEnum'], {}), '(TaskStatusEnum)\n', (651, 667), False, 'from sqlmodel import Field, Enum, Column\n')]