{
    "api_name": "TGT SAS4 Verify API",
    "version": "1.0.0",
    "base_url": "http:\/\/172.16.1.105\/api_tgt_sas4\/endpoints\/",
    "database": {
        "host": "172.16.5.159",
        "database": "DB_SAS_BACKUP"
    },
    "endpoints": [
        {
            "name": "Login",
            "method": "POST",
            "path": "\/login.php",
            "description": "ตรวจสอบ Username และ Password",
            "parameters": {
                "username": "string (required)",
                "password": "string (required)"
            },
            "example_request": {
                "username": "user1",
                "password": "1234"
            },
            "example_response": {
                "status": "success",
                "message": "Login successful",
                "data": {
                    "id": 3,
                    "username": "user1",
                    "token": "..."
                }
            }
        },
        {
            "name": "Scan PDS",
            "method": "POST",
            "path": "\/scan_pds.php",
            "description": "สแกน PDS Barcode",
            "parameters": {
                "pds_barcode": "string (required)",
                "scan_by": "string (required)"
            }
        },
        {
            "name": "Scan TAG",
            "method": "POST",
            "path": "\/scan_tag.php",
            "description": "สแกน TAG (Kanban\/Part\/007)",
            "parameters": {
                "tag_barcode": "string (required)",
                "tag_type": "string (required) - Kanban, Part, 007",
                "po": "string (required)",
                "scan_by": "string (required)",
                "tag_kanban": "string (optional)",
                "tag_part": "string (optional)",
                "part_no": "string (optional)",
                "qty": "integer (optional)"
            }
        },
        {
            "name": "Check Lock",
            "method": "GET",
            "path": "\/check_lock.php",
            "description": "ตรวจสอบสถานะ Lock"
        },
        {
            "name": "Unlock",
            "method": "POST",
            "path": "\/check_lock.php",
            "description": "ปลดล็อคระบบ",
            "parameters": {
                "action": "unlock"
            }
        },
        {
            "name": "Delivery History",
            "method": "GET",
            "path": "\/history.php",
            "description": "ดึงประวัติการ Delivery",
            "parameters": {
                "date_from": "date (optional, default: today)",
                "date_to": "date (optional, default: today)",
                "limit": "integer (optional, default: 100)",
                "offset": "integer (optional, default: 0)"
            }
        },
        {
            "name": "Lock History",
            "method": "GET",
            "path": "\/lock_history.php",
            "description": "ดึงประวัติการ Lock",
            "parameters": {
                "date_from": "date (optional)",
                "date_to": "date (optional)",
                "limit": "integer (optional)",
                "offset": "integer (optional)"
            }
        },
        {
            "name": "PDS List",
            "method": "GET",
            "path": "\/pds_list.php",
            "description": "ดึงรายการ PDS",
            "parameters": {
                "date_from": "date (optional)",
                "date_to": "date (optional)",
                "limit": "integer (optional)",
                "offset": "integer (optional)"
            }
        },
        {
            "name": "Master Parts - List",
            "method": "GET",
            "path": "\/master_parts.php?action=list",
            "description": "ดึงรายการ Part ทั้งหมด",
            "parameters": {
                "limit": "integer (optional)",
                "offset": "integer (optional)"
            }
        },
        {
            "name": "Master Parts - Get",
            "method": "GET",
            "path": "\/master_parts.php?action=get",
            "description": "ดึงข้อมูล Part ตาม Part No",
            "parameters": {
                "partno": "string (required)"
            }
        },
        {
            "name": "Master Parts - Search",
            "method": "GET",
            "path": "\/master_parts.php?action=search",
            "description": "ค้นหา Part",
            "parameters": {
                "keyword": "string (required)",
                "limit": "integer (optional)",
                "offset": "integer (optional)"
            }
        }
    ],
    "notes": [
        "- ใช้ SQL Server PDO Driver",
        "- รองรับ UTF-8 encoding",
        "- ใช้ fetch() แทน rowCount() เนื่องจาก SQL Server ไม่ support",
        "- ใช้ bindParam() กับ PDO::PARAM_INT สำหรับ OFFSET และ FETCH",
        "- CORS enabled สำหรับทุก origins"
    ]
}