from sqlmodel import SQLModel
from sqlmodel import Field, Relationship
from sqlalchemy import String
from sqlalchemy.sql.schema import Column
from typing import TYPE_CHECKING, Optional, List

if TYPE_CHECKING:
    from app.src.models.product import ProductRead
    from app.src.models.product import Product


class ProductTypeBase(SQLModel):
    name: str
    description: str


class ProductType(ProductTypeBase, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str = Field(sa_column=Column("name", String, unique=True))
    description: Optional[str] = Field(default=None)
    products: List["Product"] = 