from pydantic.types import Optional
from sqlmodel import Field, Relationship, SQLModel

from api.public.team.models import Team


class HeroBase(SQLModel):
    name: str
    secret_name: str
    age: Optional[int] = None

    team_id: Optional[int] = Field(default=None, foreign_key="team.id")

    class Config:
        schema_extra = {
            "example": {
                "id": 1,
                "name": "<NAME>",
                "secret_name": "<NAME>",
                "age": 27,
                "team_id": 1,
            }
        }


class Hero(HeroBase, table=True):
    id: Optional[int] = 