from typing import Any, Dict
from pydantic import BaseModel, Field
from enum import Enum

class ChatRequest(BaseModel):
    query: str
    chat_history: list

    class Config:
        @staticmethod
        def json_schema_extra(schema: Dict[str, Any]) -> None:
            schema["description"] = "Chat request schema"
            
class ChatResponse(BaseModel):
    role: str
    message: str
    data: list[Any]
    class Config:
        @staticmethod
        def json_schema_extra(schema: Dict[str, Any]) -> None:
            schema["description"] = "Chat request schema"
            
class report(Enum):
    unknown = "unknown"
    lodging_statistics = "lodging_statistics"
    advanced_deposits = "advanced_deposits"
    sales_by_employee = "sales_by_employee"
    departure_invoice_report = "departure_invoice_report"
    house_keeping = "house_keeping"
    tax = "tax"
            
class reportSchema(BaseModel):
    standaloneQuestion: str = Field(description="Make standalone question for user query. complete the question using previous conversations.")
    reportName: report = Field(description="NOTE: if user clearly mention to generate or make report and we have that report listed in enum only then provide report name else make it unknown for every user query.")
    fromDate: str = Field(description="yyyy-mm-dd")
    toDate: str = Field(description="yyyy-mm-dd")
    
    def __init__(self, standaloneQuestion:str, reportName:str, fromDate:str, toDate:str, **kwargs) -> None:
        self.standaloneQuestion = standaloneQuestion
        self.reportName = reportName
        self.fromDate = fromDate
        self.toDate = toDate

    
    def __setattr__(self, name, value) -> None:
        self.__dict__[name] = value

class factSchema(BaseModel):
    standaloneQuestion: str = Field(description="Make standalone question for user query. complete the question using previous conversations.")
    date: str = Field(description="yyyy-mm-dd")
    
    def __init__(self, standaloneQuestion:str, date:str, **kwargs) -> None:
        self.standaloneQuestion = standaloneQuestion
        self.date = date

    def __setattr__(self, name, value) -> None:
        self.__dict__[name] = value

class multiFactSchema(BaseModel):
    standaloneQuestion: str = Field(description="Make standalone question for user query. complete the question using previous conversations.")
    fromDate: str = Field(description="yyyy-mm-dd")
    toDate: str = Field(description="yyyy-mm-dd")
    
    def __init__(self, standaloneQuestion:str, fromDate:str, toDate:str, **kwargs) -> None:
        self.standaloneQuestion = standaloneQuestion
        self.fromDate = fromDate
        self.toDate = toDate

    def __setattr__(self, name, value) -> None:
        self.__dict__[name] = value
        
class factCode(BaseModel):
    code: str = Field(description="""write code direct here""")

class regenQuery(BaseModel):
    query: str = Field(description="Generaete sql query.")
