{
  "openapi": "3.0.4",
  "info": {
    "title": "Skrifta API",
    "description": "Arbetsmiljöverkets föreskrifter",
    "version": "1.0"
  },
  "paths": {
    "/published/provision": {
      "get": {
        "tags": [
          "Provision"
        ],
        "summary": "Returnerar föreskrifter med publicerat dokument utan fragment. Sorteras fallande på uppdateratdatum.",
        "parameters": [
          {
            "name": "skip",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "take",
            "in": "query",
            "description": "",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "x-api-version",
            "in": "header",
            "description": "The requested API version",
            "schema": {
              "type": "string",
              "default": "1.0"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Provision"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/published/provision/{id}": {
      "get": {
        "tags": [
          "Provision"
        ],
        "summary": "Returnerar föreskrift med publicerat dokument.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "x-api-version",
            "in": "header",
            "description": "The requested API version",
            "schema": {
              "type": "string",
              "default": "1.0"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Provision"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/published/provision/{id}/{hierarchy}": {
      "get": {
        "tags": [
          "Provision"
        ],
        "summary": "Returnerar fragment för publicerat dokument.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "hierarchy",
            "in": "path",
            "description": "Urlkodad",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-version",
            "in": "header",
            "description": "The requested API version",
            "schema": {
              "type": "string",
              "default": "1.0"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/FragmentImage"
                    },
                    {
                      "$ref": "#/components/schemas/FragmentList"
                    },
                    {
                      "$ref": "#/components/schemas/FragmentMath"
                    },
                    {
                      "$ref": "#/components/schemas/FragmentTable"
                    },
                    {
                      "$ref": "#/components/schemas/FragmentTableRow"
                    },
                    {
                      "$ref": "#/components/schemas/FragmentTableCell"
                    },
                    {
                      "$ref": "#/components/schemas/FragmentText"
                    },
                    {
                      "$ref": "#/components/schemas/FragmentContainer"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/published/provision/{id}/latest": {
      "get": {
        "tags": [
          "Provision"
        ],
        "summary": "Returnerar konsoliderad föreskrift med publicerat dokument baserat på originalföreskriftens id.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "x-api-version",
            "in": "header",
            "description": "The requested API version",
            "schema": {
              "type": "string",
              "default": "1.0"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Provision"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Document": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "provisionId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "integer",
            "format": "int32"
          },
          "isPublished": {
            "type": "boolean",
            "nullable": true
          },
          "createDate": {
            "type": "string",
            "format": "date-time"
          },
          "updateDate": {
            "type": "string",
            "format": "date-time"
          },
          "updateBy": {
            "type": "string",
            "nullable": true
          },
          "publishDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "file": {
            "$ref": "#/components/schemas/DocumentFile"
          },
          "fragments": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Dokument"
      },
      "DocumentFile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "type": "string",
            "format": "byte",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FragmentContainer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "containerType": {
            "$ref": "#/components/schemas/FragmentContainerType"
          }
        },
        "additionalProperties": false
      },
      "FragmentContainerType": {
        "enum": [
          "Root",
          "Preamble",
          "Rules",
          "TransitionalRegulations",
          "Appendices",
          "ListItem",
          "Paragraph",
          "Footnote"
        ],
        "type": "string"
      },
      "FragmentImage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "height": {
            "type": "number",
            "description": "Punkter (pt)",
            "format": "double"
          },
          "width": {
            "type": "number",
            "description": "Punkter (pt)",
            "format": "double"
          },
          "caption": {
            "type": "string",
            "nullable": true
          },
          "alt": {
            "type": "string",
            "nullable": true
          },
          "mediaType": {
            "type": "string",
            "nullable": true
          },
          "data": {
            "type": "string",
            "format": "byte",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FragmentList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "style": {
            "type": "string",
            "description": "Möjliga värden [ \"lower-alpha\", \"lower-roman\", \"decimal\", \"dash\" ].\r\nAlla utom \"dash\" är standard. På grund av bindestreck är detta inte enum.",
            "nullable": true
          },
          "prefixParent": {
            "type": "boolean",
            "nullable": true
          },
          "suffix": {
            "type": "string",
            "nullable": true
          },
          "isOrdered": {
            "type": "boolean",
            "readOnly": true
          },
          "start": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FragmentMath": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "height": {
            "type": "number",
            "description": "Punkter (pt)",
            "format": "double"
          },
          "width": {
            "type": "number",
            "description": "Punkter (pt)",
            "format": "double"
          },
          "alt": {
            "type": "string",
            "nullable": true
          },
          "mediaType": {
            "type": "string",
            "nullable": true
          },
          "data": {
            "type": "string",
            "format": "byte",
            "nullable": true
          },
          "mathML": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FragmentTable": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "caption": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FragmentTableCell": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "colspan": {
            "type": "integer",
            "format": "int32"
          },
          "rowspan": {
            "type": "integer",
            "format": "int32"
          },
          "isHeader": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "FragmentTableRow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "isHeader": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "FragmentText": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "hierarchy": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FragmentImage"
                },
                {
                  "$ref": "#/components/schemas/FragmentList"
                },
                {
                  "$ref": "#/components/schemas/FragmentMath"
                },
                {
                  "$ref": "#/components/schemas/FragmentTable"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableRow"
                },
                {
                  "$ref": "#/components/schemas/FragmentTableCell"
                },
                {
                  "$ref": "#/components/schemas/FragmentText"
                },
                {
                  "$ref": "#/components/schemas/FragmentContainer"
                }
              ]
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/FragmentType"
          },
          "textType": {
            "$ref": "#/components/schemas/FragmentTextType"
          },
          "text": {
            "type": "string",
            "description": "Text kan innehålla HTML (strong, em, sub, sup, br, var)",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "FragmentTextType": {
        "enum": [
          "Text",
          "Heading",
          "Part",
          "Chapter",
          "Section",
          "GeneralRecommendation",
          "Signature"
        ],
        "type": "string"
      },
      "FragmentType": {
        "enum": [
          "FragmentImage",
          "FragmentList",
          "FragmentMath",
          "FragmentTable",
          "FragmentTableRow",
          "FragmentTableCell",
          "FragmentText",
          "FragmentContainer"
        ],
        "type": "string"
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "Provision": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "$ref": "#/components/schemas/ProvisionType"
          },
          "structureType": {
            "$ref": "#/components/schemas/ProvisionStructureType"
          },
          "language": {
            "type": "string",
            "description": "Språk",
            "nullable": true
          },
          "designation": {
            "type": "string",
            "description": "Beteckning",
            "nullable": true
          },
          "title": {
            "type": "string",
            "description": "Titel",
            "nullable": true
          },
          "coverTitle": {
            "type": "string",
            "description": "Omslagstitel",
            "nullable": true
          },
          "diariumId": {
            "type": "string",
            "description": "Diarienummer",
            "nullable": true
          },
          "validDate": {
            "type": "string",
            "description": "Ikraftdatum",
            "format": "date-time",
            "nullable": true
          },
          "printDate": {
            "type": "string",
            "description": "Trycklovsdatum",
            "format": "date-time",
            "nullable": true
          },
          "decisionDate": {
            "type": "string",
            "description": "Beslutsdatum",
            "format": "date-time",
            "nullable": true
          },
          "signee": {
            "type": "string",
            "description": "Undertecknad (semikolonseparerad)",
            "nullable": true
          },
          "publisher": {
            "type": "string",
            "description": "Ansvarig utgivare",
            "nullable": true
          },
          "createDate": {
            "type": "string",
            "format": "date-time"
          },
          "updateDate": {
            "type": "string",
            "format": "date-time"
          },
          "updateBy": {
            "type": "string",
            "nullable": true
          },
          "basicProvisionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Document"
            },
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Föreskrift"
      },
      "ProvisionStructureType": {
        "enum": [
          "Basic",
          "Other",
          "Product"
        ],
        "type": "string"
      },
      "ProvisionType": {
        "enum": [
          "Basic",
          "Change",
          "Repeal",
          "Consolidated"
        ],
        "type": "string"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header"
      }
    }
  }
}