{
  "openapi": "3.1.0",
  "info": {
    "title": "Ya Investigado Public Catalog API",
    "version": "1.0.0",
    "description": "Read-only discovery of published local research dossiers and option pages. No authentication is required."
  },
  "servers": [
    {
      "url": "https://yainvestigado.com/"
    }
  ],
  "paths": {
    "/api/v1/catalog.json": {
      "get": {
        "operationId": "getPublicCatalog",
        "summary": "List published micro-locations, dossiers, and researched options",
        "responses": {
          "200": {
            "description": "The current public research catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/status.json": {
      "get": {
        "operationId": "getCatalogStatus",
        "summary": "Confirm that the static catalog API is available",
        "responses": {
          "200": {
            "description": "Availability and content freshness metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Catalog": {
        "type": "object",
        "required": [
          "schema_version",
          "site",
          "micro_locations"
        ],
        "properties": {
          "schema_version": {
            "type": "string",
            "const": "1.0"
          },
          "site": {
            "$ref": "#/components/schemas/Site"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "micro_locations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MicroLocation"
            }
          }
        }
      },
      "Site": {
        "type": "object",
        "required": [
          "name",
          "url",
          "language",
          "description"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "language": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "MicroLocation": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "name",
          "url",
          "dossiers"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "municipality": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dossiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Dossier"
            }
          }
        }
      },
      "Dossier": {
        "type": "object",
        "required": [
          "id",
          "title",
          "topic",
          "url",
          "option_count",
          "options"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "topic": {
            "type": "object",
            "required": [
              "id",
              "slug",
              "title",
              "description"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            }
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "option_count": {
            "type": "integer",
            "minimum": 0
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Option"
            }
          }
        }
      },
      "Option": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "name",
          "url",
          "freshness_timestamp",
          "source_count"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "freshness_timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "source_count": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "Status": {
        "type": "object",
        "required": [
          "status",
          "service",
          "version",
          "catalog"
        ],
        "properties": {
          "status": {
            "type": "string",
            "const": "ok"
          },
          "service": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "catalog": {
            "type": "string",
            "format": "uri"
          },
          "content_updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      }
    }
  }
}
