{
  "openapi": "3.1.0",
  "info": {
    "title": "Arash Zad public content API",
    "version": "1.0.0",
    "description": "Read-only metadata for arash.am and its published posts. No authentication is required."
  },
  "servers": [
    {
      "url": "https://arash.am"
    }
  ],
  "paths": {
    "/api/site.json": {
      "get": {
        "operationId": "getSiteProfile",
        "summary": "Get the site profile",
        "description": "Returns the public site identity, author identity, discovery links, and published post count.",
        "responses": {
          "200": {
            "description": "Public site profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteProfile"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/posts.json": {
      "get": {
        "operationId": "listPublishedPosts",
        "summary": "List published posts",
        "description": "Returns public post metadata in reverse chronological order. Drafts and fixtures never appear.",
        "responses": {
          "200": {
            "description": "Published post list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "posts"
                  ],
                  "properties": {
                    "posts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Post"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SiteProfile": {
        "type": "object",
        "required": [
          "name",
          "url",
          "description",
          "author",
          "links",
          "postCount"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "author": {
            "type": "object",
            "required": [
              "name",
              "alternateName",
              "jobTitle",
              "sameAs"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "alternateName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "jobTitle": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sameAs": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "links": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uri"
            }
          },
          "postCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Post": {
        "type": "object",
        "required": [
          "id",
          "title",
          "description",
          "url",
          "language",
          "kind",
          "publishedAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fa"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "research",
              "work",
              "note"
            ]
          },
          "publishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "resolution"
            ],
            "properties": {
              "code": {
                "type": "string",
                "example": "not_found"
              },
              "message": {
                "type": "string",
                "example": "API endpoint not found."
              },
              "resolution": {
                "type": "string",
                "example": "See https://arash.am/openapi.json for valid endpoints."
              }
            }
          }
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "The API endpoint does not exist",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
