{
  "openapi": "3.1.0",
  "info": {
    "title": "Android App Metadata API",
    "version": "3.1.0",
    "description": "Cloudflare Workers + D1 API for compact app discovery, full app metadata, screenshots, label-only links, and separately loaded Markdown changelog documents. Canonical APIs are versioned under /api/v1 and /admin/api/v1. Legacy /v1 and /admin/api aliases remain available for compatibility."
  },
  "servers": [
    {
      "url": "/",
      "description": "Current Worker deployment"
    }
  ],
  "tags": [
    {
      "name": "System"
    },
    {
      "name": "Public Apps"
    },
    {
      "name": "Public Changelog"
    },
    {
      "name": "Admin Apps"
    },
    {
      "name": "Admin Changelog"
    },
    {
      "name": "Admin Categories"
    },
    {
      "name": "Admin Screenshots"
    },
    {
      "name": "Admin Links"
    },
    {
      "name": "Legacy Admin Releases"
    },
    {
      "name": "Admin Validation"
    }
  ],
  "paths": {
    "/api/v1/health": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Verify the Worker and D1 catalogue",
        "responses": {
          "200": {
            "description": "Live D1 row counts and source identification",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/apps": {
      "get": {
        "tags": [
          "Public Apps"
        ],
        "summary": "List compact active app summaries",
        "description": "Returns the complete showcase collection as a compact snake_case payload. Use the package-specific endpoint only when full metadata is needed.",
        "responses": {
          "200": {
            "description": "Published apps with name, package_name, icon_logo, optional short_description, and category.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppsListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/apps/{package_name}": {
      "get": {
        "tags": [
          "Public Apps"
        ],
        "summary": "Get full active app details",
        "description": "Returns snake_case app metadata without the growing changelog document. Links are an ordered array of label and URL objects, so custom links never change the response schema.",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full app metadata with screenshots, label-only links, icon, description, and latest legacy version metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppDetailsResponse"
                }
              }
            }
          },
          "404": {
            "description": "App not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/apps/{package_name}/changelog.md": {
      "get": {
        "tags": [
          "Public Changelog"
        ],
        "summary": "Download the complete Markdown changelog document",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete changelog history as text/markdown.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string",
                  "example": "# Version 1.2.3:\n\n- **Minor**: Small under-the-hood improvements."
                }
              }
            }
          },
          "404": {
            "description": "App or changelog not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/apps/{package_name}/changelog": {
      "get": {
        "deprecated": true,
        "tags": [
          "Public Changelog"
        ],
        "summary": "List legacy structured changelog releases",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Legacy stable release history using snake_case keys.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangelogResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/apps/{package_name}/changelog/latest": {
      "get": {
        "deprecated": true,
        "tags": [
          "Public Changelog"
        ],
        "summary": "Get the legacy latest stable release",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Legacy latest stable release using snake_case keys when one exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LatestChangelogResponse"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps": {
      "get": {
        "tags": [
          "Admin Apps"
        ],
        "summary": "List every app as compact metadata",
        "description": "Returns all apps, including non-public entries, using the same stable compact shape as the public collection. Status, long descriptions, screenshots, links, and release data are intentionally omitted.",
        "responses": {
          "200": {
            "description": "All apps with name, package_name, icon_logo, optional short_description, and category.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppsListResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin Apps"
        ],
        "summary": "Create app metadata",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminCreateAppRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created app metadata without internal status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppDetailsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}": {
      "get": {
        "tags": [
          "Admin Apps"
        ],
        "summary": "Get one complete app JSON document",
        "description": "Returns full snake_case app metadata without internal status or the growing changelog document.",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete app metadata without internal status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppDetailsResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Admin Apps"
        ],
        "summary": "Update app metadata",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminUpdateAppRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated app metadata without internal status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppDetailsResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin Apps"
        ],
        "summary": "Delete app",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/changelog": {
      "get": {
        "tags": [
          "Admin Changelog"
        ],
        "summary": "Get the editable Markdown changelog document",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete editable changelog document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangelogDocumentResponse"
                }
              }
            }
          },
          "404": {
            "description": "App not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Admin Changelog"
        ],
        "summary": "Replace the Markdown changelog document",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminUpdateChangelogRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated changelog document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangelogDocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid changelog document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "App not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/categories": {
      "get": {
        "tags": [
          "Admin Categories"
        ],
        "summary": "List categories",
        "responses": {
          "200": {
            "description": "Categories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin Categories"
        ],
        "summary": "Create category",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/categories/{category_id}": {
      "put": {
        "tags": [
          "Admin Categories"
        ],
        "summary": "Update category",
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin Categories"
        ],
        "summary": "Delete category",
        "parameters": [
          {
            "name": "category_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/screenshots": {
      "get": {
        "tags": [
          "Admin Screenshots"
        ],
        "summary": "List editable screenshots",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Screenshots with admin-only IDs for editing.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "screenshots": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AdminScreenshot"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin Screenshots"
        ],
        "summary": "Create screenshot",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminScreenshotInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "screenshots": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AdminScreenshot"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/screenshots/{screenshot_id}": {
      "put": {
        "tags": [
          "Admin Screenshots"
        ],
        "summary": "Update screenshot or order",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "screenshot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminScreenshotInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "screenshots": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AdminScreenshot"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin Screenshots"
        ],
        "summary": "Delete screenshot",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "screenshot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/links": {
      "get": {
        "tags": [
          "Admin Links"
        ],
        "summary": "List editable label-only links",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Links with admin-only IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AdminLink"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Admin Links"
        ],
        "summary": "Create a labelled link",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminLinkInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AdminLink"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "A link with the same label already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/links/{link_id}": {
      "put": {
        "tags": [
          "Admin Links"
        ],
        "summary": "Update a labelled link",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "link_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminLinkInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AdminLink"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "A link with the same label already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin Links"
        ],
        "summary": "Delete link",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "link_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/releases": {
      "get": {
        "deprecated": true,
        "tags": [
          "Legacy Admin Releases"
        ],
        "summary": "List legacy release rows",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Legacy release rows retained for backwards compatibility.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "post": {
        "deprecated": true,
        "tags": [
          "Legacy Admin Releases"
        ],
        "summary": "Create legacy release row",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminCreateReleaseRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/releases/{release_id}": {
      "put": {
        "deprecated": true,
        "tags": [
          "Legacy Admin Releases"
        ],
        "summary": "Update legacy release row",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "release_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminUpdateReleaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "delete": {
        "deprecated": true,
        "tags": [
          "Legacy Admin Releases"
        ],
        "summary": "Delete legacy release row",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "release_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/validation": {
      "get": {
        "tags": [
          "Admin Validation"
        ],
        "summary": "Validate app readiness",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Validation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          }
        }
      }
    },
    "/admin/api/v1/apps/{package_name}/publish": {
      "post": {
        "tags": [
          "Admin Validation"
        ],
        "summary": "Validate and publish app",
        "parameters": [
          {
            "name": "package_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published app metadata without internal status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppDetailsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AppSummary": {
        "type": "object",
        "required": [
          "name",
          "package_name",
          "icon_logo",
          "category"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "Android Studio Tutorials"
          },
          "package_name": {
            "type": "string",
            "example": "com.d4rk.androidtutorials"
          },
          "icon_logo": {
            "type": "string",
            "format": "uri",
            "example": "https://play-lh.googleusercontent.com/example-icon"
          },
          "short_description": {
            "type": "string",
            "example": "Learn how to make simple apps in Android Studio."
          },
          "category": {
            "type": "object",
            "required": [
              "label",
              "category_id"
            ],
            "properties": {
              "label": {
                "type": "string",
                "example": "Education"
              },
              "category_id": {
                "type": "string",
                "example": "education"
              }
            }
          }
        }
      },
      "AppListItem": {
        "type": "object",
        "required": [
          "name",
          "package_name",
          "category",
          "description",
          "icon_logo",
          "screenshots",
          "links"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "package_name": {
            "type": "string"
          },
          "category": {
            "type": "object",
            "required": [
              "label",
              "category_id"
            ],
            "properties": {
              "label": {
                "type": "string",
                "example": "Education"
              },
              "category_id": {
                "type": "string",
                "example": "education"
              }
            }
          },
          "description": {
            "type": "string"
          },
          "short_description": {
            "type": "string"
          },
          "icon_logo": {
            "type": "string"
          },
          "screenshots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Screenshot"
            }
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Link"
            }
          },
          "latest_version": {
            "$ref": "#/components/schemas/LatestVersion"
          }
        }
      },
      "AppDetails": {
        "$ref": "#/components/schemas/AppListItem"
      },
      "Screenshot": {
        "type": "object",
        "required": [
          "url",
          "aspect_ratio",
          "device_type"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "aspect_ratio": {
            "type": "string",
            "pattern": "^(unknown|[1-9][0-9]*:[1-9][0-9]*)$"
          },
          "device_type": {
            "type": "string",
            "enum": [
              "phone",
              "tablet",
              "wear",
              "desktop",
              "unknown"
            ]
          }
        }
      },
      "Link": {
        "type": "object",
        "required": [
          "label",
          "url"
        ],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "example": "Privacy Policy"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://",
            "example": "https://example.com/privacy"
          }
        }
      },
      "LatestVersion": {
        "type": "object",
        "required": [
          "version_name",
          "version_code"
        ],
        "properties": {
          "version_name": {
            "type": "string"
          },
          "version_code": {
            "type": "integer"
          },
          "released_at": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          }
        }
      },
      "ChangelogDocument": {
        "type": "object",
        "required": [
          "package_name",
          "changelog_markdown"
        ],
        "properties": {
          "package_name": {
            "type": "string",
            "example": "com.d4rk.androidtutorials"
          },
          "changelog_markdown": {
            "type": "string",
            "description": "Complete Markdown changelog history, newest version first.",
            "example": "# Version 1.2.3:\n\n- **Minor**: Small under-the-hood improvements."
          }
        }
      },
      "ChangelogDocumentResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ChangelogDocument"
          }
        }
      },
      "Release": {
        "type": "object",
        "required": [
          "version_name",
          "version_code",
          "channel"
        ],
        "properties": {
          "version_name": {
            "type": "string"
          },
          "version_code": {
            "type": "integer"
          },
          "channel": {
            "type": "string",
            "enum": [
              "stable",
              "beta",
              "internal",
              "draft"
            ]
          },
          "released_at": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "changelog_markdown": {
            "type": "string"
          }
        }
      },
      "AppsListResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "apps"
            ],
            "properties": {
              "apps": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AppSummary"
                }
              }
            }
          }
        }
      },
      "AppDetailsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "app": {
                "$ref": "#/components/schemas/AppDetails"
              }
            }
          }
        }
      },
      "AdminScreenshotInput": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "aspect_ratio": {
            "type": "string",
            "pattern": "^(unknown|[1-9][0-9]*:[1-9][0-9]*)$"
          },
          "device_type": {
            "type": "string",
            "enum": [
              "phone",
              "tablet",
              "wear",
              "desktop",
              "unknown"
            ]
          },
          "sort_order": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AdminScreenshot": {
        "type": "object",
        "required": [
          "id",
          "url",
          "aspect_ratio",
          "device_type"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "app_package_name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "aspect_ratio": {
            "type": "string",
            "pattern": "^(unknown|[1-9][0-9]*:[1-9][0-9]*)$"
          },
          "device_type": {
            "type": "string",
            "enum": [
              "phone",
              "tablet",
              "wear",
              "desktop",
              "unknown"
            ]
          },
          "sort_order": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AdminLinkInput": {
        "type": "object",
        "required": [
          "label",
          "url"
        ],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "example": "Privacy Policy"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://",
            "example": "https://example.com/privacy"
          }
        }
      },
      "AdminLink": {
        "type": "object",
        "required": [
          "id",
          "app_package_name",
          "label",
          "url"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "app_package_name": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://"
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        }
      },
      "ChangelogResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "package_name": {
                "type": "string"
              },
              "releases": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Release"
                }
              }
            }
          }
        }
      },
      "LatestChangelogResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "package_name": {
                "type": "string"
              },
              "release": {
                "$ref": "#/components/schemas/Release"
              }
            }
          }
        }
      },
      "AdminCreateAppRequest": {
        "type": "object",
        "required": [
          "name",
          "package_name",
          "category_id",
          "description",
          "icon_logo"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "package_name": {
            "type": "string"
          },
          "category_id": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "short_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "icon_logo": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "hidden",
              "deprecated",
              "draft"
            ]
          }
        }
      },
      "AdminUpdateAppRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "package_name": {
            "type": "string"
          },
          "category_id": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "short_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "icon_logo": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "hidden",
              "deprecated",
              "draft"
            ]
          }
        }
      },
      "AdminUpdateChangelogRequest": {
        "type": "object",
        "required": [
          "changelog_markdown"
        ],
        "properties": {
          "changelog_markdown": {
            "type": "string",
            "maxLength": 200000,
            "description": "Complete Markdown changelog history, newest version first."
          }
        }
      },
      "AdminCreateReleaseRequest": {
        "type": "object",
        "required": [
          "version_name",
          "version_code"
        ],
        "properties": {
          "version_name": {
            "type": "string"
          },
          "version_code": {
            "type": "integer"
          },
          "channel": {
            "type": "string",
            "enum": [
              "stable",
              "beta",
              "internal",
              "draft"
            ]
          },
          "released_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_latest": {
            "type": "boolean"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "changelog_markdown": {
            "type": "string"
          }
        }
      },
      "AdminUpdateReleaseRequest": {
        "type": "object",
        "properties": {
          "version_name": {
            "type": "string"
          },
          "version_code": {
            "type": "integer"
          },
          "channel": {
            "type": "string",
            "enum": [
              "stable",
              "beta",
              "internal",
              "draft"
            ]
          },
          "released_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_latest": {
            "type": "boolean"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "changelog_markdown": {
            "type": "string"
          }
        }
      },
      "ValidationIssue": {
        "type": "object",
        "required": [
          "severity",
          "code",
          "message"
        ],
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning"
            ]
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "field": {
            "type": "string"
          }
        }
      },
      "ValidationResult": {
        "type": "object",
        "required": [
          "package_name",
          "can_publish",
          "issues"
        ],
        "properties": {
          "package_name": {
            "type": "string"
          },
          "can_publish": {
            "type": "boolean"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationIssue"
            }
          }
        }
      }
    }
  }
}