{
  "openapi": "3.1.0",
  "info": {
    "title": "TradfallningBoras.se — begär offert",
    "version": "1.0.0",
    "description": "Skickar en offertförfrågan för trädfällning, stubbfräsning, trädbeskärning och bortforsling i Borås. Användaren måste ha samtyckt (consent=true)."
  },
  "servers": [
    {
      "url": "https://tradfallningboras.se"
    }
  ],
  "paths": {
    "/api/offert": {
      "post": {
        "operationId": "begarOffert",
        "summary": "Begär offert",
        "parameters": [
          {
            "name": "X-Dry-Run",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            },
            "description": "Validera utan att skicka."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Offert"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Förfrågan mottagen"
          },
          "200": {
            "description": "Torrkörning giltig"
          },
          "422": {
            "description": "Valideringsfel"
          },
          "429": {
            "description": "För många förfrågningar"
          }
        }
      },
      "get": {
        "operationId": "beskrivning",
        "summary": "Kort beskrivning av API:t",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Offert": {
        "type": "object",
        "required": [
          "namn",
          "epost",
          "ort",
          "beskrivning",
          "consent"
        ],
        "properties": {
          "namn": {
            "type": "string",
            "maxLength": 120
          },
          "telefon": {
            "type": "string",
            "maxLength": 40
          },
          "epost": {
            "type": "string",
            "format": "email"
          },
          "ort": {
            "type": "string",
            "maxLength": 120
          },
          "tjanst": {
            "type": "string",
            "description": "Trädfällning | Stubbfräsning | Ta bort stubbe | Trädbeskärning | Arborist | Akut hjälp | Annat"
          },
          "beskrivning": {
            "type": "string",
            "maxLength": 2000
          },
          "consent": {
            "type": "boolean",
            "const": true,
            "description": "Användaren har samtyckt till att vi behandlar uppgifterna."
          },
          "agente_nome": {
            "type": "string",
            "maxLength": 80,
            "description": "Namn på agenten som skickar."
          }
        }
      }
    }
  }
}