{
  "openapi": "3.0.0",
  "info": {
    "title": "UDG Knjige API",
    "version": "1.0.0",
    "description": "API za proveru oslobađanja kredita studenata"
  },
  "paths": {
    "/gov/api/oslobadjanje-kredita": {
      "get": {
        "summary": "Provera oslobađanja kredita",
        "description": "Proverava da li student ispunjava uslove za oslobađanje kredita na osnovu JMBG-a",
        "parameters": [
          {
            "name": "jmbg",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{13}$"
            },
            "description": "JMBG studenta (tačno 13 cifara)"
          }
        ],
        "responses": {
          "200": {
            "description": "Uspešan odgovor",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fakultet": { "type": "string", "example": "Fakultet informacionih tehnologija" },
                    "nivo_studija": { 
                      "type": "string", 
                      "enum": ["OSNOVNE", "MASTER"],
                      "example": "OSNOVNE" 
                    },
                    "indeks": { "type": "string", "example": "2020/123" },
                    "ime": { "type": "string", "example": "Petar" },
                    "prezime": { "type": "string", "example": "Petrović" },
                    "prosjecna_ocjena": { "type": "number", "format": "float", "example": 8.75 },
                    "godina_upisa": { "type": "integer", "example": 2020 },
                    "godina_zavrsetka": { "type": "integer", "example": 2024 }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Neispravan JMBG format",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": { "type": "integer", "example": 400 },
                    "message": { "type": "string", "example": "JMBG mora biti u formatu od 13 cifara." }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Student nije pronađen",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": { "type": "integer", "example": 404 },
                    "message": { "type": "string", "example": "Student sa traženim JMBG-om nije pronađen u bazi podataka." }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ]
}
