{
  "openapi": "3.0.3",
  "info": {
    "title": "hiking.chunlin.ch API",
    "version": "1.0.0",
    "description": "成都周边徒步路线查询 API"
  },
  "servers": [
    {
      "url": "https://hiking.chunlin.ch"
    }
  ],
  "paths": {
    "/api/routes": {
      "get": {
        "summary": "查询路线",
        "parameters": [
          {
            "name": "star",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "逗号分隔，例 1星,2星"
          },
          {
            "name": "region",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "全字段模糊搜索"
          },
          {
            "name": "min_dist",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "max_dist",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_gain",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "max_gain",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_hours",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "max_hours",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "star",
                "-star",
                "dist",
                "-dist",
                "gain",
                "-gain",
                "hours",
                "-hours"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 500
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "has_location",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ]
      }
    },
    "/api/routes/{id}": {
      "get": {
        "summary": "单条路线",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/api/regions": {
      "get": {
        "summary": "归属地列表"
      }
    },
    "/api/stats": {
      "get": {
        "summary": "统计与星级语义"
      }
    },
    "/api/search": {
      "get": {
        "summary": "搜索",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/recommend": {
      "get": {
        "summary": "按预算推荐",
        "parameters": [
          {
            "name": "max_hours",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "max_dist",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "max_gain",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "region",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_star",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 8
            }
          },
          {
            "name": "max_star",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 8
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ]
      }
    }
  }
}