{
  "openapi": "3.1.1",
  "info": {
    "title": "AntennaScraper.Api | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://antenna.gerretzen.eu/"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "tags": [
          "IndexEndpoint"
        ],
        "summary": "Home page",
        "description": "Does nothing",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/log": {
      "get": {
        "tags": [
          "SyncLogEndpoint"
        ],
        "summary": "Get latest sync time",
        "description": "Gets the latest log entry for the sync process. Useful for automatically downloading new data only when there is an update.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncLogDto"
                }
              }
            }
          }
        }
      }
    },
    "/all": {
      "get": {
        "tags": [
          "GetAllEndpoint"
        ],
        "summary": "Gets all base stations with their antennas, carriers, bands, and providers.",
        "description": "Gets all base stations with their antennas, carriers, bands, and providers. I don't recommend using this endpoint unless you really dislike SQLite as this will return a lot of data. The dump endpoint is a better alternative for most use cases and returns a SQLite dump of the same data.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BaseStationDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/stats": {
      "get": {
        "tags": [
          "GetStatsEndpoint"
        ],
        "summary": "Get counts of various entities in the database.",
        "description": "Returns statistics the number of antennas, bands, base stations, carriers, and providers stored in the database.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatsDto"
                }
              }
            }
          }
        }
      }
    },
    "/dump": {
      "get": {
        "tags": [
          "AntennaScraper.Api"
        ],
        "summary": "Dump the entire database as a SQLite file (might take a while to download).",
        "description": "Dumps the entire database to SQLite and returns it as a file download. Note that this might take a while to generate and download, for me at the time of writing this endpoint takes about a minute before I have the dump on my drive.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AntennaDto": {
        "required": [
          "frequency",
          "height",
          "direction",
          "transmissionPower",
          "satCode",
          "isDirectional",
          "dateOfCommissioning",
          "carrier"
        ],
        "type": "object",
        "properties": {
          "frequency": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "height": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "direction": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "transmissionPower": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "satCode": {
            "type": "string"
          },
          "isDirectional": {
            "type": "boolean"
          },
          "dateOfCommissioning": {
            "type": [
              "null",
              "string"
            ],
            "format": "date"
          },
          "carrier": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CarrierDto"
              }
            ]
          }
        }
      },
      "BaseStationDto": {
        "required": [
          "location",
          "providerName",
          "municipality",
          "postalCode",
          "city",
          "isSmallCell",
          "antennas"
        ],
        "type": "object",
        "properties": {
          "location": {
            "$ref": "#/components/schemas/Point"
          },
          "providerName": {
            "type": "string"
          },
          "municipality": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "isSmallCell": {
            "type": "boolean"
          },
          "antennas": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/AntennaDto"
            }
          }
        }
      },
      "CarrierDto": {
        "required": [
          "frequencyLow",
          "frequencyHigh",
          "bandDescription"
        ],
        "type": "object",
        "properties": {
          "frequencyLow": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "frequencyHigh": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "bandDescription": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "Point": { },
      "StatsDto": {
        "required": [
          "numAntennas",
          "numBands",
          "numBaseStations",
          "numCarriers",
          "numProviders"
        ],
        "type": "object",
        "properties": {
          "numAntennas": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "numBands": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "numBaseStations": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "numCarriers": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "numProviders": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "SyncLogDto": {
        "required": [
          "start",
          "end",
          "isSuccessful"
        ],
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "isSuccessful": {
            "type": "boolean"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "IndexEndpoint"
    },
    {
      "name": "SyncLogEndpoint"
    },
    {
      "name": "GetAllEndpoint"
    },
    {
      "name": "GetStatsEndpoint"
    },
    {
      "name": "AntennaScraper.Api"
    }
  ]
}