#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Check one request in MySQL."""

import pymysql
import json

DB_CONFIG = {
    "host": "192.168.1.76",
    "port": 3306,
    "user": "root",
    "password": "Vlado9674+",
    "database": "medevio",
    "charset": "utf8mb4",
    "cursorclass": pymysql.cursors.DictCursor,
}

REQUEST_ID = "6b46b5a8-b080-4821-86b0-39adabeec86b"

conn = pymysql.connect(**DB_CONFIG)
with conn.cursor() as cur:
    cur.execute("SELECT * FROM pozadavky WHERE id = %s", (REQUEST_ID,))
    row = cur.fetchone()
conn.close()

if row:
    # Convert datetime objects to strings for JSON serialization
    for k, v in row.items():
        if hasattr(v, 'isoformat'):
            row[k] = v.isoformat()
    print(json.dumps(row, indent=2, ensure_ascii=False, default=str))
else:
    print(f"Not found: {REQUEST_ID}")
