File size: 9,533 Bytes
6f053b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
import requests
import json
import sys 

def print_separator():
    print("\n" + "-" * 80 + "\n")


def print_assitant_response(response):
    
    print_separator()
    print("\n 🤖 Asistente: ", response)
    print_separator()
    

    if isinstance(response, dict):
        
        if "to_user" in response:
            print_assitant_response(response["to_user"])
            

def make_request(url, headers, payload):
    try:
        response = requests.post(url, headers=headers, json=payload)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"Error al hacer la solicitud: {e}")
        sys.exit(1)

def create_client():

    print("\n 👤 Creando nuevo cliente...\n")
    print_separator()

def show_menu():
    print("\n" + "=" * 40)
    print("      APP DE SEGUROS - MENÚ PRINCIPAL")
    print("=" * 40)
    print("📄 1. Consultar mis seguros")
    print("   Revisa el detalle de tus seguros vigentes\n")
    print("☎️  2. Reportar emergencia")
    print("   Conoce los números para reportar alguna emergencia\n")
    print("💲 3. Pagos")
    print("   Consulta cómo pagar, estado de tus pagos\n")
    print("🔍 4. Inspección de mi auto")
    print("   Coordina tu inspección vehicular\n")
    print("📝 5. Gestiones y Reclamos")
    print("   Ingresa o consulta el estado de tu requerimiento\n")
    print("🛒 6. Cotizar un seguro")
    print("   Explora los seguros disponibles y recibe asesoría\n")
    print("🤔 7. Consultas Banco")
    print("   Conoce los canales de atención del banco\n") 
    print("=" * 40)

def consult_insurance_policy():
    print("\n🔍 Consultando información de pólizas...\n")
    
    # Placeholder details - Replace with actual API endpoint and valid data
    url = "https://api.insurance-provider.com/v1/policies/consult" # PLACEHOLDER
    
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_ACCESS_TOKEN", # PLACEHOLDER
        "Accept": "application/json"
    }
    
    # Swagger-style payload
    payload = {
        "client_identification": "12345678", # PLACEHOLDER
        "request_type": "active_policies"
    }

    print(f"Request URL: {url}")
    print(f"Method: POST")
    print(f"Headers: {json.dumps(headers, indent=2)}")
    print(f"Payload: {json.dumps(payload, indent=2)}")
    
    # Uncomment the following line to actually make the request
    # response = make_request(url, headers, payload)
    
    # Simulating a response for demonstration purposes
    simulated_response = {
        "status": "success",
        "data": {
            "policies": [
                {"policy_number": "POL-998877", "type": "Auto", "status": "Active"},
                {"policy_number": "POL-112233", "type": "Life", "status": "Active"}
            ]
        }
    }
    print_assitant_response(simulated_response)


def report_emergency():
    print("\n☎️  Reportando emergencia...\n")
    
    # Placeholder details
    url = "https://api.insurance-provider.com/v1/emergencies/report"
    
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_ACCESS_TOKEN", 
        "Accept": "application/json"
    }
    
    payload = {
        "client_identification": "12345678",
        "emergency_type": "Car Accident",
        "location": "Current GPS Location"
    }

    print(f"Request URL: {url}")
    print(f"Method: POST")
    print(f"Headers: {json.dumps(headers, indent=2)}")
    print(f"Payload: {json.dumps(payload, indent=2)}")
    
    # response = make_request(url, headers, payload)
    
    simulated_response = {
        "status": "success",
        "data": {
            "case_number": "EMG-2023-001",
            "message": "Emergencia reportada. Una unidad va en camino.",
            "estimated_arrival": "15 minutos"
        }
    }
    print_assitant_response(simulated_response)


def consult_payments():
    print("\n💲 Consultando pagos...\n")
    
    url = "https://api.insurance-provider.com/v1/payments/status"
    
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_ACCESS_TOKEN",
        "Accept": "application/json"
    }
    
    payload = {
        "client_identification": "12345678"
    }

    print(f"Request URL: {url}")
    print(f"Method: GET") 
    print(f"Headers: {json.dumps(headers, indent=2)}")
    print(f"Payload: {json.dumps(payload, indent=2)}")

    # response = make_request(url, headers, payload)

    simulated_response = {
        "status": "success",
        "data": {
            "outstanding_balance": 0.00,
            "last_payment_date": "2023-10-15",
            "next_payment_due": "2023-11-15",
            "amount_due": 150.00
        }
    }
    print_assitant_response(simulated_response)


def schedule_inspection():
    print("\n🔍 Coordinando inspección vehicular...\n")
    
    url = "https://api.insurance-provider.com/v1/inspections/schedule"
    
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_ACCESS_TOKEN",
        "Accept": "application/json"
    }
    
    payload = {
        "client_identification": "12345678",
        "preferred_date": "2023-11-01",
        "plate_number": "ABC-123"
    }

    print(f"Request URL: {url}")
    print(f"Method: POST")
    print(f"Headers: {json.dumps(headers, indent=2)}")
    print(f"Payload: {json.dumps(payload, indent=2)}")
    
    # response = make_request(url, headers, payload)
    
    simulated_response = {
        "status": "success",
        "data": {
            "inspection_id": "INS-9988",
            "confirmed_date": "2023-11-01T10:00:00",
            "center": "Centro de Inspección Norte"
        }
    }
    print_assitant_response(simulated_response)


def manage_claims():
    print("\n📝 Gestionando reclamos...\n")
    
    url = "https://api.insurance-provider.com/v1/claims/list"
    
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_ACCESS_TOKEN",
        "Accept": "application/json"
    }
    
    payload = {
        "client_identification": "12345678",
        "status_filter": "open"
    }

    print(f"Request URL: {url}")
    print(f"Method: POST")
    print(f"Headers: {json.dumps(headers, indent=2)}")
    print(f"Payload: {json.dumps(payload, indent=2)}")
    
    # response = make_request(url, headers, payload)
    
    simulated_response = {
        "status": "success",
        "data": {
            "claims": [
                {
                    "claim_id": "CLM-456",
                    "status": "In Review",
                    "description": "Minor bumper damage"
                }
            ]
        }
    }
    print_assitant_response(simulated_response)


def quote_new_insurance():
    print("\n🛒 Cotizando nuevo seguro...\n")
    
    url = "https://api.insurance-provider.com/v1/quotes/new"
    
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_ACCESS_TOKEN",
        "Accept": "application/json"
    }
    
    payload = {
        "client_identification": "12345678",
        "insurance_type": "Home",
        "coverage_amount": 200000
    }

    print(f"Request URL: {url}")
    print(f"Method: POST")
    print(f"Headers: {json.dumps(headers, indent=2)}")
    print(f"Payload: {json.dumps(payload, indent=2)}")
    
    # response = make_request(url, headers, payload)
    
    simulated_response = {
        "status": "success",
        "data": {
            "quote_id": "QT-777",
            "monthly_premium": 25.50,
            "coverage_details": "Fire, Theft, Natural Disasters"
        }
    }
    print_assitant_response(simulated_response)


def consult_bank_channel():
    print("\n🤔 Consultando canales del banco...\n")
    
    url = "https://api.insurance-provider.com/v1/bank/channels"
    
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_ACCESS_TOKEN",
        "Accept": "application/json"
    }
    
    payload = {
        "query": "customer service hours"
    }

    print(f"Request URL: {url}")
    print(f"Method: GET")
    print(f"Headers: {json.dumps(headers, indent=2)}")
    print(f"Payload: {json.dumps(payload, indent=2)}")
    
    # response = make_request(url, headers, payload)
    
    simulated_response = {
        "status": "success",
        "data": {
            "phone": "555-0199",
            "website": "www.bank.com",
            "hours": "Mon-Fri 9am-5pm"
        }
    }
    print_assitant_response(simulated_response)


def main():
    while True:
        show_menu()
        choice = input("\n👉 Selecciona una opción (1-7) o 'q' para salir: ")

        if choice == '1':
            consult_insurance_policy()
        elif choice == '2':
            report_emergency()
        elif choice == '3':
            consult_payments()
        elif choice == '4':
            schedule_inspection()
        elif choice == '5':
            manage_claims()
        elif choice == '6':
            quote_new_insurance()
        elif choice == '7':
            consult_bank_channel()
        elif choice.lower() == 'q':
            print("\n👋 Saliendo de la aplicación. ¡Hasta luego!\n")
            break
        else:
            print("\n❌ Opción no válida. Por favor intenta de nuevo.\n")
        
        input("Presiona Enter para continuar...")

if __name__ == "__main__":
    main()