from typing import Optional
from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean
from datetime import datetime


class BaseModel(SQLModel):
    """
    BaseModel class
    """

    class Config:
        use_enum_values = True


class BaseTableFields(SQLModel):
    """
    BaseTableField class
    """

    id: Optional[int] = Field(default=None, primary_key=True, nullable=False)

    created_at: Optional[datetime] = Field(
        default=None,
        sa_column=Column(
            DateTime(timezone=True),
            server_default=func.now(),
            nullable=False,
        )
    )

    updated_at: Optional[datetime] = Field(
        default=None,
        sa_column=Column(
            DateTime(timezone=True),
            server_default=func.now(),
            onupdate=func.now(),
            nullable=False,
        )
    )

    is_active: Optional[bool] = Field(
        default=None,
        sa_column=Column(Boolean, server_default='true', default=True)
    )

sqlmodel.func.now sqlmodel.Field sqlmodel.Column sqlmodel.DateTime
[((344, 397), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'primary_key': '(True)', 'nullable': '(False)'}), '(default=None, primary_key=True, nullable=False)\n', (349, 397), False, 'from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean\n'), ((937, 989), 'sqlmodel.Column', 'Column', (['Boolean'], {'server_default': '"""true"""', 'default': '(True)'}), "(Boolean, server_default='true', default=True)\n", (943, 989), False, 'from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean\n'), ((503, 526), 'sqlmodel.DateTime', 'DateTime', ([], {'timezone': '(True)'}), '(timezone=True)\n', (511, 526), False, 'from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean\n'), ((716, 739), 'sqlmodel.DateTime', 'DateTime', ([], {'timezone': '(True)'}), '(timezone=True)\n', (724, 739), False, 'from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean\n'), ((555, 565), 'sqlmodel.func.now', 'func.now', ([], {}), '()\n', (563, 565), False, 'from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean\n'), ((768, 778), 'sqlmodel.func.now', 'func.now', ([], {}), '()\n', (776, 778), False, 'from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean\n'), ((801, 811), 'sqlmodel.func.now', 'func.now', ([], {}), '()\n', (809, 811), False, 'from sqlmodel import SQLModel, Field, func, DateTime, Column, Boolean\n')]