{
  "openapi": "3.1.0",
  "info": {
    "title": "altinkacoldu.com Market Data API",
    "version": "1.0.0",
    "description": "Current gold, foreign exchange, and silver prices used by altinkacoldu.com."
  },
  "servers": [
    {
      "url": "https://altinkacoldu.com"
    }
  ],
  "paths": {
    "/api/market.json": {
      "get": {
        "summary": "Get current market prices",
        "description": "Returns the latest cached market snapshot used on the site.",
        "operationId": "getMarketData",
        "responses": {
          "200": {
            "description": "Latest market snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketResponse"
                }
              }
            }
          },
          "503": {
            "description": "Market data is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "MarketResponse": {
        "type": "object",
        "required": [
          "updatedAt",
          "displayDate",
          "prices"
        ],
        "properties": {
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "displayDate": {
            "type": "string",
            "description": "Formatted date in Turkish locale."
          },
          "prices": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/MarketPrice"
            }
          }
        }
      },
      "MarketPrice": {
        "type": "object",
        "required": [
          "buy",
          "sell",
          "trend"
        ],
        "properties": {
          "buy": {
            "type": "string"
          },
          "sell": {
            "type": "string"
          },
          "changePercent": {
            "type": [
              "number",
              "null"
            ]
          },
          "trend": {
            "type": "string",
            "enum": [
              "up",
              "down",
              "flat"
            ]
          }
        }
      },
      "MarketError": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}
