{
  "install_config": {
    "type": "object",
    "properties": {
      "timeoutMs": {
        "type": "integer",
        "default": 30000
      },
      "rateLimitMs": {
        "type": "integer",
        "default": 0
      },
      "maxRecords": {
        "type": "integer",
        "default": 100000
      },
      "maxResponseBytes": {
        "type": "integer",
        "default": 262144000
      },
      "allowedDomains": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "userAgent": {
        "type": "string",
        "default": "Semogram-HttpDataset/0.0.1"
      },
      "maxRedirects": {
        "type": "integer",
        "default": 5
      },
      "auth": {
        "type": "object",
        "description": "Protected credentials shared by endpoints using this installation.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "bearer",
              "api_key_header",
              "api_key_query",
              "basic"
            ]
          },
          "token": {
            "type": "string",
            "secret": true
          },
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string",
            "secret": true
          },
          "username": {
            "type": "string"
          },
          "password": {
            "type": "string",
            "secret": true
          }
        }
      }
    }
  },
  "source_stream": {
    "type": "object",
    "required": [
      "request",
      "response"
    ],
    "properties": {
      "request": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST"
            ],
            "default": "GET"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "query": {
            "type": "object",
            "description": "Query parameters; every value is a string, including numbers and dates.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "object"
          }
        }
      },
      "response": {
        "type": "object",
        "required": [
          "format"
        ],
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "json",
              "csv",
              "zip_json",
              "zip_csv"
            ],
            "default": "json"
          },
          "recordsPath": {
            "type": "string"
          },
          "zipEntry": {
            "type": "string"
          }
        }
      },
      "fields": {
        "type": "object",
        "description": "Output field names mapped to a source dot path, or to { source, type, default } to also coerce the value.",
        "additionalProperties": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "required": [
                "source"
              ],
              "properties": {
                "source": {
                  "type": "string",
                  "description": "Dot path in each source record."
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "integer",
                    "boolean",
                    "timestamp",
                    "json"
                  ]
                }
              }
            }
          ]
        }
      },
      "window": {
        "type": "object",
        "description": "Optional time window sent with every request. since_last resumes where the last successful run ended; rolling reads the last lookback each run.",
        "required": [
          "startParameter",
          "lookback"
        ],
        "properties": {
          "startParameter": {
            "type": "string",
            "description": "Parameter that receives the window start, such as starttime."
          },
          "endParameter": {
            "type": "string",
            "description": "Optional parameter that receives the window end, such as endtime."
          },
          "location": {
            "type": "string",
            "enum": [
              "query",
              "body"
            ],
            "default": "query"
          },
          "mode": {
            "type": "string",
            "enum": [
              "since_last",
              "rolling"
            ],
            "default": "since_last"
          },
          "lookback": {
            "type": "string",
            "description": "ISO 8601 duration such as P30D or PT6H: the first since_last window, the most it reaches back, and the rolling window length."
          },
          "overlap": {
            "type": "string",
            "description": "ISO 8601 duration re-read before the last window end, for late-arriving records."
          },
          "format": {
            "type": "string",
            "enum": [
              "iso",
              "date",
              "epoch_ms",
              "epoch_s"
            ],
            "default": "iso"
          }
        }
      },
      "pagination": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "none",
              "page",
              "offset",
              "cursor",
              "link"
            ],
            "default": "none"
          },
          "location": {
            "type": "string",
            "enum": [
              "query",
              "body"
            ],
            "default": "query"
          },
          "parameter": {
            "type": "string"
          },
          "responsePath": {
            "type": "string"
          },
          "start": {
            "type": "integer"
          },
          "pageSizeParameter": {
            "type": "string"
          },
          "pageSize": {
            "type": "integer"
          },
          "limitParameter": {
            "type": "string"
          },
          "limit": {
            "type": "integer"
          },
          "maxPages": {
            "type": "integer",
            "default": 100
          }
        }
      },
      "primaryKeys": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "stream": {
        "type": "string",
        "default": "records"
      }
    }
  }
}
