74 lines
2.3 KiB
Python
74 lines
2.3 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import List, Optional, Dict, Any
|
|
from datetime import datetime
|
|
|
|
# --- DEVICE SCHEMAS ---
|
|
class CrmCustomerDeviceCreate(BaseModel):
|
|
customer_id: str
|
|
brand: str
|
|
model_name: str
|
|
color: Optional[str] = None
|
|
imei_serial: str
|
|
cosmetic_condition: Optional[str] = None
|
|
notes: Optional[str] = None
|
|
|
|
class CrmCustomerDeviceResponse(CrmCustomerDeviceCreate):
|
|
device_id: str
|
|
tenant_id: str
|
|
created_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
# --- REPAIR TICKET SCHEMAS ---
|
|
class CrmRepairTicketCreate(BaseModel):
|
|
customer_id: str
|
|
device_id: str
|
|
issue_description: str
|
|
assigned_technician_id: Optional[str] = None
|
|
is_warranty_claim: Optional[bool] = False
|
|
notes: Optional[str] = None
|
|
|
|
class CrmRepairTicketUpdateStage(BaseModel):
|
|
stage: str # RECEIVED, DIAGNOSING, PART_PENDING, UNDER_REPAIR, QC_TESTING, READY_FOR_DELIVERY, CLOSED, CANCELLED
|
|
notes: Optional[str] = None
|
|
|
|
class CrmRepairTicketUpdateChecklist(BaseModel):
|
|
diagnostic_checklist_json: Optional[Dict[str, Any]] = None
|
|
qc_checklist_json: Optional[Dict[str, Any]] = None
|
|
|
|
class CrmRepairTicketUpdateEstimate(BaseModel):
|
|
estimate_amount: float
|
|
estimate_approved_by_customer: bool
|
|
|
|
class CrmRepairTicketAssignTechnician(BaseModel):
|
|
assigned_technician_id: str
|
|
|
|
class CrmRepairTicketResponse(BaseModel):
|
|
ticket_id: str
|
|
ticket_number: str
|
|
tenant_id: str
|
|
customer_id: str
|
|
device_id: str
|
|
assigned_technician_id: Optional[str] = None
|
|
stage: str
|
|
issue_description: str
|
|
diagnostic_checklist_json: Optional[Dict[str, Any]] = None
|
|
qc_checklist_json: Optional[Dict[str, Any]] = None
|
|
estimate_amount: float
|
|
estimate_approved_by_customer: bool
|
|
is_warranty_claim: bool
|
|
notes: Optional[str] = None
|
|
created_at: Optional[datetime] = None
|
|
status: Optional[str] = None
|
|
problem_description: Optional[str] = None
|
|
customer_name: Optional[str] = None
|
|
customer_phone: Optional[str] = None
|
|
brand_name: Optional[str] = None
|
|
model_name: Optional[str] = None
|
|
imei_serial: Optional[str] = None
|
|
priority: Optional[str] = "NORMAL"
|
|
sla_due_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|