{
  "openapi": "3.0.3",
  "info": {
    "title": "L2 Calendar API",
    "description": "Public, keyless JSON API that lists Lineage 2 private server openings by chronicle. No authentication required; responses are CORS-enabled (Access-Control-Allow-Origin: *).",
    "version": "1.0.0",
    "contact": {
      "name": "L2 Calendar",
      "url": "https://l2calendar.com"
    },
    "termsOfService": "https://l2calendar.com/"
  },
  "servers": [
    {
      "url": "https://l2calendar.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Servers",
      "description": "Tracked Lineage 2 private servers"
    },
    {
      "name": "Chronicles",
      "description": "Lineage 2 chronicle catalog"
    }
  ],
  "paths": {
    "/api/servers": {
      "get": {
        "operationId": "listServers",
        "summary": "List tracked servers",
        "description": "Returns up to 50 servers (VIP first, then soonest opening). Optionally filtered by chronicle.",
        "tags": [
          "Servers"
        ],
        "parameters": [
          {
            "name": "chronicle",
            "in": "query",
            "required": false,
            "description": "Chronicle slug, e.g. interlude, high-five, classic, essence.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of tracked servers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Server"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/chronicles": {
      "get": {
        "operationId": "listChronicles",
        "summary": "List chronicles",
        "description": "Returns the chronicle catalog (id, name, slug, display order) usable as the `chronicle` filter.",
        "tags": [
          "Chronicles"
        ],
        "responses": {
          "200": {
            "description": "Chronicle catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Chronicle"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Server": {
        "type": "object",
        "required": [
          "public_ref",
          "name",
          "website_url",
          "rate",
          "opening_date"
        ],
        "properties": {
          "public_ref": {
            "type": "string",
            "description": "Opaque public handle for this listing. Use it for /goto/?ref=<public_ref> links. The internal database id is never exposed.",
            "pattern": "^[a-f0-9]{16}$"
          },
          "name": {
            "type": "string"
          },
          "website_url": {
            "type": "string",
            "format": "uri"
          },
          "rate": {
            "type": "string",
            "description": "Display rate, e.g. x5, x1000, GvE, 1."
          },
          "opening_date": {
            "type": "string",
            "format": "date"
          },
          "opening_time": {
            "type": "string",
            "nullable": true
          },
          "opening_datetime_utc": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "is_vip": {
            "type": "boolean"
          },
          "vip_level": {
            "type": "integer"
          },
          "multiproff": {
            "type": "boolean"
          },
          "multicraft": {
            "type": "boolean"
          },
          "is_new": {
            "type": "boolean"
          },
          "chronicle": {
            "$ref": "#/components/schemas/ServerChronicle"
          },
          "labels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Label"
            }
          }
        }
      },
      "ServerChronicle": {
        "type": "object",
        "nullable": true,
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "Label": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        }
      },
      "Chronicle": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "display_order": {
            "type": "integer"
          }
        }
      }
    }
  }
}
