from datetime import datetime
from typing import Optional
from sqlmodel import Field, SQLModel, Relationship
from sqlalchemy import Column
from sqlalchemy.dialects.postgresql import JSON


class ZeroShotInferenceBase(SQLModel):
    text: str = Field(nullable=False, index=True)
    candidate_labels: list[str] = Field(
        nullable=False, index=True, sa_column=Column(JSON)
    )


class ZeroShotInference(ZeroShotInferenceBase, table=True):
    id: Optional[int] = Field(default=None, nullable=False, primary_key=True)
    result: dict[str, float] = Field(nullable=False, sa_column=Column(JSON))
    created_at: Optional[datetime]
    updated_at: Optional[datetime]
    created_by_id: Optional[int] = Field(default=None, foreign_key="user.id")
    created_by: "User" = Relationship(
        sa_relationship_kwargs={
            "lazy": "selectin",
            "primaryjoin": "ZeroShotInference.created_by_id == User.id",
        }
    )

sqlmodel.Relationship sqlmodel.Field sqlalchemy.Column
[((244, 277), 'sqlmodel.Field', 'Field', ([], {'nullable': '(False)', 'index': '(True)'}), '(nullable=False, index=True)\n', (249, 277), False, 'from sqlmodel import Field, SQLModel, Relationship\n'), ((470, 523), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'nullable': '(False)', 'primary_key': '(True)'}), '(default=None, nullable=False, primary_key=True)\n', (475, 523), False, 'from sqlmodel import Field, SQLModel, Relationship\n'), ((706, 748), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'foreign_key': '"""user.id"""'}), "(default=None, foreign_key='user.id')\n", (711, 748), False, 'from sqlmodel import Field, SQLModel, Relationship\n'), ((774, 896), 'sqlmodel.Relationship', 'Relationship', ([], {'sa_relationship_kwargs': "{'lazy': 'selectin', 'primaryjoin':\n    'ZeroShotInference.created_by_id == User.id'}"}), "(sa_relationship_kwargs={'lazy': 'selectin', 'primaryjoin':\n    'ZeroShotInference.created_by_id == User.id'})\n", (786, 896), False, 'from sqlmodel import Field, SQLModel, Relationship\n'), ((365, 377), 'sqlalchemy.Column', 'Column', (['JSON'], {}), '(JSON)\n', (371, 377), False, 'from sqlalchemy import Column\n'), ((587, 599), 'sqlalchemy.Column', 'Column', (['JSON'], {}), '(JSON)\n', (593, 599), False, 'from sqlalchemy import Column\n')]