{
  "swagger": "2.0",
  "info": {
    "title": "聚玩店铺服务",
    "description": "管理店铺信息、员工邀请、模板配置。ID 字段（int64）以 string 传输",
    "version": "1.0"
  },
  "schemes": [
    "http",
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/api/v1/shops": {
      "get": {
        "summary": "获取店铺列表",
        "operationId": "ListShops",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopListResp"
            }
          }
        },
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": true,
            "type": "integer",
            "format": "int64",
            "default": "0"
          },
          {
            "name": "limit",
            "in": "query",
            "required": true,
            "type": "integer",
            "format": "int64",
            "default": "20"
          }
        ],
        "tags": [
          "shop"
        ],
        "consumes": [
          "multipart/form-data"
        ]
      },
      "post": {
        "summary": "创建店铺",
        "operationId": "CreateShop",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopProfile"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/CreateShopReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/invitations/mine": {
      "get": {
        "summary": "获取我收到的邀请",
        "operationId": "MyInvitations",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopInvitationListResp"
            }
          }
        },
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/invitations/{id}": {
      "delete": {
        "summary": "拒绝邀请",
        "operationId": "RejectInvitation",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/EmptyResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/AcceptInvitationReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/invitations/{id}/accept": {
      "post": {
        "summary": "接受邀请",
        "operationId": "AcceptInvitation",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/EmptyResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/AcceptInvitationReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/mine": {
      "get": {
        "summary": "获取当前用户的店铺",
        "operationId": "GetMyShop",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopProfile"
            }
          }
        },
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/{id}": {
      "get": {
        "summary": "获取店铺详情",
        "operationId": "GetShop",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopProfile"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "shop"
        ]
      },
      "put": {
        "summary": "更新店铺信息",
        "operationId": "UpdateShop",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopProfile"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateShopReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/{id}/announcements": {
      "post": {
        "summary": "新增店铺公告",
        "operationId": "AddAnnouncement",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/EmptyResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/AnnouncementReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/{id}/announcements/{index}": {
      "delete": {
        "summary": "删除店铺公告",
        "operationId": "DeleteAnnouncement",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/EmptyResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "index",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/DeleteAnnouncementReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/{id}/income-stats": {
      "get": {
        "summary": "获取收入统计",
        "operationId": "GetShopIncomeStats",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/IncomeStatsResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/{id}/invitations": {
      "get": {
        "summary": "获取店铺邀请列表",
        "operationId": "ListShopInvitations",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopInvitationListResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "shop"
        ]
      },
      "post": {
        "summary": "邀请打手",
        "operationId": "InvitePlayer",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/EmptyResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/InvitationReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/{id}/players/{playerId}": {
      "delete": {
        "summary": "移除打手",
        "operationId": "RemovePlayer",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/EmptyResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "playerId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/RemovePlayerReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/shops/{id}/template": {
      "put": {
        "summary": "更新店铺模板",
        "operationId": "UpdateShopTemplate",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/EmptyResp"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateTemplateReq"
            }
          }
        ],
        "tags": [
          "shop"
        ]
      }
    },
    "/api/v1/users/{id}/shop": {
      "get": {
        "summary": "获取店长的店铺",
        "operationId": "GetUserShop",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ShopProfile"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "shop"
        ]
      }
    }
  },
  "definitions": {
    "AcceptInvitationReq": {
      "type": "object",
      "title": "AcceptInvitationReq"
    },
    "AnnouncementReq": {
      "type": "object",
      "properties": {
        "content": {
          "type": "string"
        }
      },
      "title": "AnnouncementReq",
      "required": [
        "content"
      ]
    },
    "CreateShopReq": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "commissionType": {
          "type": "string"
        },
        "commissionValue": {
          "type": "string"
        }
      },
      "title": "CreateShopReq",
      "required": [
        "name",
        "description",
        "commissionType",
        "commissionValue"
      ]
    },
    "DeleteAnnouncementReq": {
      "type": "object",
      "title": "DeleteAnnouncementReq"
    },
    "EmptyResp": {
      "type": "object",
      "title": "EmptyResp"
    },
    "IncomeStatsResp": {
      "type": "object",
      "properties": {
        "monthlyIncome": {
          "type": "string"
        },
        "pendingSettlement": {
          "type": "string"
        },
        "totalWithdrawn": {
          "type": "string"
        },
        "totalOrders": {
          "type": "integer",
          "format": "int64"
        },
        "completedOrders": {
          "type": "integer",
          "format": "int64"
        }
      },
      "title": "IncomeStatsResp",
      "required": [
        "monthlyIncome",
        "pendingSettlement",
        "totalWithdrawn",
        "totalOrders",
        "completedOrders"
      ]
    },
    "InvitationReq": {
      "type": "object",
      "properties": {
        "playerId": {
          "type": "integer",
          "format": "int64"
        }
      },
      "title": "InvitationReq",
      "required": [
        "playerId"
      ]
    },
    "PageMeta": {
      "type": "object",
      "properties": {
        "total": {
          "type": "integer",
          "format": "int64"
        },
        "offset": {
          "type": "integer",
          "format": "int64"
        },
        "limit": {
          "type": "integer",
          "format": "int64"
        }
      },
      "title": "PageMeta",
      "required": [
        "total",
        "offset",
        "limit"
      ]
    },
    "PageReq": {
      "type": "object",
      "properties": {
        "offset": {
          "type": "integer",
          "format": "int64",
          "default": "0"
        },
        "limit": {
          "type": "integer",
          "format": "int64",
          "default": "20"
        }
      },
      "title": "PageReq",
      "required": [
        "offset",
        "limit"
      ]
    },
    "RemovePlayerReq": {
      "type": "object",
      "title": "RemovePlayerReq"
    },
    "ShopIdReq": {
      "type": "object",
      "title": "ShopIdReq"
    },
    "ShopInvitation": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64"
        },
        "shopId": {
          "type": "integer",
          "format": "int64"
        },
        "playerId": {
          "type": "integer",
          "format": "int64"
        },
        "status": {
          "type": "string"
        },
        "invitedBy": {
          "type": "integer",
          "format": "int64"
        },
        "createdAt": {
          "type": "integer",
          "format": "int64"
        },
        "respondedAt": {
          "type": "integer",
          "format": "int64"
        }
      },
      "title": "ShopInvitation",
      "required": [
        "id",
        "shopId",
        "playerId",
        "status",
        "invitedBy",
        "createdAt"
      ]
    },
    "ShopInvitationListResp": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ShopInvitation"
          }
        }
      },
      "title": "ShopInvitationListResp",
      "required": [
        "items"
      ]
    },
    "ShopListResp": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ShopProfile"
          }
        },
        "meta": {
          "$ref": "#/definitions/PageMeta"
        }
      },
      "title": "ShopListResp",
      "required": [
        "items",
        "meta"
      ]
    },
    "ShopProfile": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "owner": {
          "$ref": "#/definitions/UserProfile"
        },
        "name": {
          "type": "string"
        },
        "banner": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "rating": {
          "type": "string"
        },
        "totalOrders": {
          "type": "integer",
          "format": "int64"
        },
        "playerCount": {
          "type": "integer",
          "format": "int64"
        },
        "commissionType": {
          "type": "string"
        },
        "commissionValue": {
          "type": "string"
        },
        "allowMultiShop": {
          "type": "boolean",
          "format": "boolean"
        },
        "allowIndependentOrders": {
          "type": "boolean",
          "format": "boolean"
        },
        "dispatchMode": {
          "type": "string"
        },
        "announcements": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "templateConfig": {
          "type": "object"
        }
      },
      "title": "ShopProfile",
      "required": [
        "id",
        "owner",
        "name",
        "description",
        "rating",
        "totalOrders",
        "playerCount",
        "commissionType",
        "commissionValue",
        "allowMultiShop",
        "allowIndependentOrders",
        "dispatchMode",
        "announcements",
        "templateConfig"
      ]
    },
    "SimpleUser": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "nickname": {
          "type": "string"
        },
        "avatar": {
          "type": "string"
        }
      },
      "title": "SimpleUser",
      "required": [
        "id",
        "nickname",
        "avatar"
      ]
    },
    "UpdateShopReq": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "commissionType": {
          "type": "string"
        },
        "commissionValue": {
          "type": "string"
        },
        "allowMultiShop": {
          "type": "boolean",
          "format": "boolean"
        },
        "allowIndependentOrders": {
          "type": "boolean",
          "format": "boolean"
        },
        "dispatchMode": {
          "type": "string"
        }
      },
      "title": "UpdateShopReq"
    },
    "UpdateTemplateReq": {
      "type": "object",
      "properties": {
        "sections": {
          "type": "string"
        }
      },
      "title": "UpdateTemplateReq",
      "required": [
        "sections"
      ]
    },
    "UserIdReq": {
      "type": "object",
      "title": "UserIdReq"
    },
    "UserProfile": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "username": {
          "type": "string"
        },
        "nickname": {
          "type": "string"
        },
        "avatar": {
          "type": "string"
        },
        "role": {
          "type": "string",
          "description": " consumer, player, owner, admin"
        },
        "verifiedRoles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "verificationStatus": {
          "type": "object"
        },
        "phone": {
          "type": "string"
        },
        "bio": {
          "type": "string"
        },
        "createdAt": {
          "type": "string"
        }
      },
      "title": "UserProfile",
      "required": [
        "id",
        "username",
        "nickname",
        "avatar",
        "role",
        "verifiedRoles",
        "verificationStatus",
        "createdAt"
      ]
    }
  },
  "securityDefinitions": {
    "apiKey": {
      "type": "apiKey",
      "description": "Enter JWT Bearer token **_only_**",
      "name": "Authorization",
      "in": "header"
    }
  }
}
