diff --git a/schemas/state.py b/schemas/state.py new file mode 100644 index 0000000..68a31b0 --- /dev/null +++ b/schemas/state.py @@ -0,0 +1,25 @@ +# Base Schema +class StateBase(BaseModel): + name: str = Field(..., unique=True, index=True, description="Name of the state") + abbreviation: str = Field(..., unique=True, index=True, description="Abbreviation of the state") + is_active: bool = Field(True, description="Whether the state is active or not") + + class Config: + schema_extra = { + "example": { + "name": "California", + "abbreviation": "CA", + "is_active": True + } + } + +# Create Schema +class StateCreate(StateBase): + pass + +# Response Schema +class StateResponse(StateBase): + id: int + + class Config: + orm_mode = True \ No newline at end of file