{
  "openapi": "3.0.3",
  "info": {
    "title": "山啸门店 API",
    "version": "1.0.0",
    "description": "供已开通门店服务的租户管理员在自有系统中读取本租户经营资料。请使用本租户后台域名，以有效管理员会话的 Authorization: Bearer <token> 请求。本规范列出的三个操作均为只读；管理员会话本身具有管理权限，请勿交给外部服务或嵌入公开网页。"
  },
  "servers": [
    {
      "url": "https://{tenant}.montshock.com",
      "description": "租户后台域名",
      "variables": {
        "tenant": {
          "default": "montshock",
          "description": "替换为本租户已分配的子域名前缀"
        }
      }
    }
  ],
  "tags": [
    {
      "name": "门店资料"
    }
  ],
  "security": [
    {
      "tenantAdmin": []
    }
  ],
  "paths": {
    "/v1/api/admin/stores": {
      "get": {
        "tags": [
          "门店资料"
        ],
        "operationId": "listTenantStores",
        "summary": "查询租户门店",
        "description": "包含已停用门店，按 sort、id 升序。",
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        200
                      ]
                    },
                    "msg": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Store"
                      }
                    }
                  },
                  "required": [
                    "code",
                    "msg",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "无法识别租户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "缺少有效的租户登录凭证",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "缺少管理权限、当前租户与登录身份不一致或服务未开通",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "租户不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "查询失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/brands": {
      "get": {
        "tags": [
          "门店资料"
        ],
        "operationId": "listTenantBrands",
        "summary": "查询商品品牌",
        "description": "按品牌名称升序。",
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        200
                      ]
                    },
                    "msg": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Brand"
                      }
                    }
                  },
                  "required": [
                    "code",
                    "msg",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "无法识别租户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "缺少有效的租户登录凭证",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "缺少管理权限、当前租户与登录身份不一致或服务未开通",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "租户不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "查询失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/api/admin/categories": {
      "get": {
        "tags": [
          "门店资料"
        ],
        "operationId": "listTenantCategories",
        "summary": "查询商品分类树",
        "description": "从根分类返回最多三级，各层按 priority 降序、id 升序。",
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "enum": [
                        200
                      ]
                    },
                    "msg": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Category"
                      }
                    }
                  },
                  "required": [
                    "code",
                    "msg",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "无法识别租户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "缺少有效的租户登录凭证",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "缺少管理权限、当前租户与登录身份不一致或服务未开通",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "租户不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "查询失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "tenantAdmin": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "本租户管理员登录后获得的有效会话令牌。"
      }
    },
    "schemas": {
      "Store": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "district": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "business_hours": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "sort": {
            "type": "integer"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at",
          "updated_at",
          "name",
          "code",
          "province",
          "city",
          "district",
          "address",
          "phone",
          "lat",
          "lng",
          "business_hours",
          "active",
          "sort",
          "description"
        ]
      },
      "Brand": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at",
          "updated_at",
          "name",
          "code"
        ]
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "alias": {
            "type": "string"
          },
          "parent_id": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "priority": {
            "type": "integer"
          },
          "is_hidden": {
            "type": "boolean"
          },
          "param_templates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "unit": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "unit"
              ]
            },
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          }
        },
        "required": [
          "id",
          "created_at",
          "updated_at",
          "name",
          "parent_id",
          "priority",
          "is_hidden",
          "param_templates"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer"
          },
          "msg": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "msg"
        ]
      }
    }
  }
}
