{
  "openapi": "3.1.0",
  "info": {
    "title": "Google address geocoding for TRAK site pins",
    "description": "TRAK geocodes a site address using a configured server key. The browser map uses a separate key.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://maps.googleapis.com"
    }
  ],
  "paths": {
    "/maps/api/geocode/json": {
      "get": {
        "operationId": "geocodeTRAKSiteAddress",
        "summary": "Find site coordinates for an address",
        "security": [
          {
            "serverKey": []
          }
        ],
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The site address, URL encoded."
          }
        ],
        "responses": {
          "200": {
            "description": "Check the provider status. For OK results TRAK reads results[0].geometry.location.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "error_message": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "geometry": {
                            "type": "object",
                            "properties": {
                              "location": {
                                "type": "object",
                                "properties": {
                                  "lat": {
                                    "type": "number",
                                    "minimum": -90,
                                    "maximum": 90
                                  },
                                  "lng": {
                                    "type": "number",
                                    "minimum": -180,
                                    "maximum": 180
                                  }
                                },
                                "required": [
                                  "lat",
                                  "lng"
                                ]
                              }
                            },
                            "required": [
                              "location"
                            ]
                          }
                        },
                        "required": [
                          "geometry"
                        ]
                      }
                    }
                  },
                  "required": [
                    "status",
                    "results"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Review the server credential, enabled API and provider response, or enter site coordinates manually."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "serverKey": {
        "type": "apiKey",
        "in": "query",
        "name": "key",
        "description": "Google server geocoding credential."
      }
    }
  }
}
