You are helping me build a Gateway connectivity report against the Tenovi Hardware Integration API. GOAL Produce a script that pulls every Gateway on my account, identifies which ones are unhealthy, and outputs a report I can act on. ASK ME FIRST Before writing any code, ask me these questions and wait for my answers: 1. Which client domain should this tool send API calls against? I can find mine in the Tenovi web app on the HWI settings page for the account I intend to use. See https://docs.tenovi.com/hwi-api/api-url-config/ for background on client domains and how they shape the request URL. 2. What language and runtime do you want this tool written in? 3. What output should this tool produce? For example CSV, JSON, a console table, or a write to a database. 4. How many days without a measurement should count as inactive? 5. Which fields do you want in the output? Do not assume answers to these. If I skip one, ask again. REFERENCE Before writing any code, fetch and read https://docs.tenovi.com/llms.txt and the recipe at https://docs.tenovi.com/recipes/gateway-connectivity-report/. Use those as the source of truth for endpoint behavior, field names, and response shapes. If anything below conflicts with the documentation, follow the documentation and tell me about the conflict. CONFIGURATION Base URL: https://api2.tenovi.com/clients/{CLIENT_DOMAIN}/hwi/ Client domain: replace CLIENT_DOMAIN with the client domain I give you above. Make it a configurable value rather than a hardcoded string. Authentication: an API key passed in an Authorization header. Never write an API key into the code, into this prompt, or into any file you generate. Leave it as a clearly marked placeholder and read it at runtime from an environment variable, or better, from whatever secret storage and retrieval mechanism my environment already uses. If you are unsure which applies here, ask me. ENDPOINTS Step 1, list all Gateways: curl --location 'https://api2.tenovi.com/clients/CLIENT_DOMAIN/hwi/hwi-gateways/' \ --header 'Authorization: Api-Key API_KEY_HERE' Supports the query parameters ?ordering=-last_measurement and ?page_size=100. Paginated. Follow the "next" link until exhausted. Returns per Gateway: gateway_uuid, last_signal_strength, last_measurement, shipped_on, assigned_on. Maximum page_size is 1000, but larger pages increase response latency. Step 2, get detail for a single Gateway: curl --location 'https://api2.tenovi.com/clients/CLIENT_DOMAIN/hwi/gateway-info/123412341234/' \ --header 'Authorization: Api-Key API_KEY_HERE' The trailing path segment is the gateway_uuid. Returns: gateway_uuid, firmware_version, bootloader_version, provisioned, last_signal_strength, last_checkin_time, assigned_on, shipped_on, whitelisted_devices. The two endpoints return different connectivity fields. last_measurement appears only on the list endpoint and indicates whether the patient is taking readings. last_checkin_time appears only on the detail endpoint and indicates whether the Gateway is reaching the Tenovi network at all. CONSTRAINTS - Rate limit is 1 request per second per API key. Throttle accordingly and handle 429 responses with backoff. Use 1.2 second delays for breathing room. - Gateway UUIDs must be passed with no hyphens. - All timestamps are UTC in ISO 8601 format. Compute staleness in UTC. - Step 2 costs one request per Gateway. Do not call it for every Gateway. Use the Step 1 response to select candidates, then inspect only those. - Use only the endpoints, parameters, and fields listed above. Do not invent endpoints or query parameters. If you need something not listed here, say so rather than guessing. REQUIREMENTS - No hardcoded secrets. See the authentication note above. - Handle pagination on the Gateway list endpoint. - Throttle to the rate limit and retry on transient failures. - Handle a 404 from the detail endpoint without stopping the run. - Print a summary at the end: total Gateways scanned, count per health bucket, count never checked in, count with stale measurements. - Comment the code so I can modify the bucket logic later.