{
  "openapi": "3.1.0",
  "info": {
    "title": "富士鮨 Availability API",
    "version": "1.0.0",
    "description": "空席の目安（計算値・約10分ごと更新）。予約の確定は TableCheck で行うこと。"
  },
  "servers": [
    {
      "url": "https://availability.akagai.app"
    }
  ],
  "paths": {
    "/api/v1/availability.json": {
      "get": {
        "operationId": "getAvailability",
        "summary": "直近の空席目安スナップショットを取得",
        "responses": {
          "200": {
            "description": "現在のスナップショット（status: ok | stale）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Availability"
                }
              }
            }
          },
          "503": {
            "description": "期限切れ・未生成（status: expired | unavailable）。空席データなし。Retry-After付き"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Availability": {
        "type": "object",
        "properties": {
          "schema_version": {
            "type": "integer",
            "const": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "stale"
            ]
          },
          "availability_kind": {
            "type": "string",
            "const": "calculated_estimate"
          },
          "timezone": {
            "type": "string",
            "const": "Asia/Tokyo"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "valid_until": {
            "type": "string",
            "format": "date-time"
          },
          "horizon_days": {
            "type": "integer"
          },
          "restaurant": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "reservation_url": {
                "type": "string",
                "format": "uri"
              },
              "phone": {
                "type": "string"
              },
              "seating": {
                "type": "string"
              },
              "larger_parties": {
                "type": "string"
              }
            }
          },
          "disclaimer": {
            "type": "string"
          },
          "days": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "day_of_week": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "Sun",
                    "Mon",
                    "Tue",
                    "Wed",
                    "Thu",
                    "Fri",
                    "Sat",
                    null
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "open",
                    "closed",
                    "unknown"
                  ]
                },
                "open_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_entry_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "note": {
                  "type": "string"
                },
                "availability_suppressed": {
                  "type": "boolean"
                },
                "slots": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "description": "null = 非公開（unknown/suppressed）。[] や空sizesと混同しないこと",
                  "items": {
                    "type": "object",
                    "properties": {
                      "start": {
                        "type": "string",
                        "description": "入店時刻 HH:MM"
                      },
                      "available_party_sizes": {
                        "type": "array",
                        "description": "空配列 = その時刻は満席",
                        "items": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}