File size: 1,417 Bytes
680fa2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import uuid
from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel, Field

class RosterWorkerCreate(BaseModel):
    name: str = Field(..., min_length=2)
    skill: str = Field(..., min_length=2)
    phone_status: str = Field("IVR only", pattern="^(IVR only|Verified)$")
    status: str = Field("Available", pattern="^(Available|On job)$")
    commission: int = Field(0, ge=0)

class RosterWorkerResponse(BaseModel):
    id: uuid.UUID
    mediator_id: uuid.UUID
    name: str
    skill: str
    phone_status: str
    status: str
    commission: int
    created_at: datetime

    class Config:
        from_attributes = True

class AdminAlertResponse(BaseModel):
    id: uuid.UUID
    type: str # Dispute, Fraud, IVR
    text: str
    severity: str # red, orange, gray
    status: str # active, resolved
    created_at: datetime

    class Config:
        from_attributes = True

class UserAdminView(BaseModel):
    id: uuid.UUID
    name: str
    phone: str
    role: str
    city: str
    is_active: bool
    created_at: datetime

    class Config:
        from_attributes = True

class AdminAnalytics(BaseModel):
    total_workers: int
    total_customers: int
    total_jobs: int
    active_bookings: int
    gmv: int
    platform_commission: int
    disputes_count: int
    fraud_alerts_count: int
    ivr_alerts_count: int

    class Config:
        from_attributes = True