38 lines
986 B
Python
38 lines
986 B
Python
"""Pydantic schemas for Insight Feedback."""
|
|
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
from typing import Optional, Dict, Any
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
from decimal import Decimal
|
|
|
|
|
|
class InsightFeedbackBase(BaseModel):
|
|
"""Base schema for Insight Feedback."""
|
|
|
|
action_taken: str
|
|
result_data: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
|
success: bool
|
|
error_message: Optional[str] = None
|
|
expected_impact_value: Optional[Decimal] = None
|
|
actual_impact_value: Optional[Decimal] = None
|
|
variance_percentage: Optional[Decimal] = None
|
|
|
|
|
|
class InsightFeedbackCreate(InsightFeedbackBase):
|
|
"""Schema for creating feedback."""
|
|
|
|
insight_id: UUID
|
|
applied_by: Optional[str] = "system"
|
|
|
|
|
|
class InsightFeedbackResponse(InsightFeedbackBase):
|
|
"""Schema for feedback response."""
|
|
|
|
id: UUID
|
|
insight_id: UUID
|
|
applied_by: str
|
|
created_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|