.
This commit is contained in:
43
src/capa_de_integracion/models/quick_replies.py
Normal file
43
src/capa_de_integracion/models/quick_replies.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""
|
||||
Copyright 2025 Google. This software is provided as-is, without warranty or
|
||||
representation for any use or purpose. Your use of it is subject to your
|
||||
agreement with Google.
|
||||
|
||||
Quick Replies data models.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class QuestionDTO(BaseModel):
|
||||
"""Individual FAQ question."""
|
||||
|
||||
titulo: str
|
||||
descripcion: str | None = None
|
||||
respuesta: str
|
||||
|
||||
|
||||
class QuickReplyDTO(BaseModel):
|
||||
"""Quick reply screen with questions."""
|
||||
|
||||
header: str | None = None
|
||||
body: str | None = None
|
||||
button: str | None = None
|
||||
header_section: str | None = None
|
||||
preguntas: list[QuestionDTO] = Field(default_factory=list)
|
||||
|
||||
|
||||
class QuickReplyScreenRequestDTO(BaseModel):
|
||||
"""Request to load a quick reply screen."""
|
||||
|
||||
usuario: dict = Field(..., alias="usuario")
|
||||
canal: str = Field(..., alias="canal")
|
||||
tipo: str = Field(..., alias="tipo")
|
||||
pantalla_contexto: str = Field(..., alias="pantallaContexto")
|
||||
|
||||
model_config = {"populate_by_name": True}
|
||||
|
||||
@property
|
||||
def telefono(self) -> str:
|
||||
"""Extract phone number from usuario."""
|
||||
return self.usuario.get("telefono", "")
|
||||
Reference in New Issue
Block a user