from typing import Optional
from bson import ObjectId
from pydantic import BaseModel, Field
from app.models.entities import PyObjectId


class SubjectEntity(BaseModel):
    id: Optional[PyObjectId] = Field(default=None, alias="_id")
    name: str
    short_name: str
    description: Optional[str] = None
    icon: Optional[str] = None

    class ConfigDict:
        populate_by_name = True
        json_encoders = {ObjectId: str}
        json_schema_extra = {}
