openapi: 3.1.0
info:
  title: api-partyassets
  contact: {}
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  version: "6.5"
servers:
- url: http://localhost:63868
  description: Generated server url
tags:
- name: Metadata - Statusreasons
  description: Statusreasons operations
paths:
  /{municipalityId}/metadata/statusreasons/{status}:
    get:
      tags:
      - Metadata - Statusreasons
      summary: Get status reasons
      operationId: readReasons
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: status
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/Status"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    post:
      tags:
      - Metadata - Statusreasons
      summary: Create status reasons
      operationId: createReasons
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: status
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/Status"
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
        required: true
      responses:
        "201":
          description: Created - Successful operation
          headers:
            Location:
              description: Location of the created resource.
              style: simple
              schema:
                type: string
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    delete:
      tags:
      - Metadata - Statusreasons
      summary: Delete status reasons
      operationId: deleteReasons
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: status
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/Status"
      responses:
        "204":
          description: No content - Successful operation
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/assets:
    get:
      tags:
      - Assets
      summary: Get assets
      operationId: getAssets
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: assetId
        in: query
        description: External asset id (e.g. PRH-123456789) used as an identifier
          by external systems
        required: false
        schema:
          type: string
          description: External asset id (e.g. PRH-123456789) used as an identifier
            by external systems
          examples:
          - PRH-123456789
      - name: origin
        in: query
        description: Source of origin for the asset
        required: false
        schema:
          type: string
          description: Source of origin for the asset
          examples:
          - CASEDATA
      - name: partyId
        in: query
        description: PartyId
        required: true
        schema:
          type: string
          description: PartyId
          examples:
          - 123e4567-e89b-12d3-a456-426614174000
      - name: type
        in: query
        description: Asset type
        required: false
        schema:
          type: string
          description: Asset type
          examples:
          - PERMIT
      - name: issued
        in: query
        description: Issued date
        required: false
        schema:
          type: string
          format: date
          description: Issued date
          examples:
          - 2021-01-01
      - name: validTo
        in: query
        description: Valid to date
        required: false
        schema:
          type: string
          format: date
          description: Valid to date
          examples:
          - 2021-12-31
      - name: status
        in: query
        description: Asset status
        required: false
        schema:
          $ref: "#/components/schemas/Status"
      - name: statusReason
        in: query
        description: Status reason
        required: false
        schema:
          type: string
          description: Status reason
          examples:
          - Status reason
      - name: description
        in: query
        description: Asset description
        required: false
        schema:
          type: string
          description: Asset description
          examples:
          - Asset description
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Asset"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    post:
      tags:
      - Assets
      summary: Create an asset
      operationId: createAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: sourceReference
        in: query
        description: "Relation reference in format (target part is ignored): '{relationType}|{sourceResourceId};{sourceType};{sourceService};{sourceNamespace}|{targetResourceId};{targetType};{targetService};{targetNamespace}'"
        required: false
        schema:
          type: string
        example: LINK|1234;case;service;MY_NAMESPACE|
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetCreateRequest"
        required: true
      responses:
        "201":
          description: Created - Successful operation
          headers:
            Location:
              description: Location of the created resource.
              style: simple
              schema:
                type: string
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/assets/{id}:
    get:
      tags:
      - Assets
      summary: Get asset
      operationId: getAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    post:
      tags:
      - Assets
      summary: Copy an active asset as a draft
      operationId: copyAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "201":
          description: Created - Successful operation
          headers:
            Location:
              description: Location of the created resource.
              style: simple
              schema:
                type: string
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    delete:
      tags:
      - Assets
      summary: Delete an asset
      operationId: deleteAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No content - Successful operation
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    patch:
      tags:
      - Assets
      summary: Update an asset
      operationId: updateAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetUpdateRequest"
        required: true
      responses:
        "204":
          description: No content - Successful operation
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/asset-drafts:
    get:
      tags:
      - Draft Assets
      summary: Get draft assets
      operationId: getDraftAssets
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: assetId
        in: query
        description: External asset id (e.g. PRH-123456789) used as an identifier
          by external systems
        required: false
        schema:
          type: string
          description: External asset id (e.g. PRH-123456789) used as an identifier
            by external systems
          examples:
          - PRH-123456789
      - name: origin
        in: query
        description: Source of origin for the asset
        required: false
        schema:
          type: string
          description: Source of origin for the asset
          examples:
          - CASEDATA
      - name: partyId
        in: query
        description: PartyId
        required: true
        schema:
          type: string
          description: PartyId
          examples:
          - 123e4567-e89b-12d3-a456-426614174000
      - name: type
        in: query
        description: Asset type
        required: false
        schema:
          type: string
          description: Asset type
          examples:
          - PERMIT
      - name: issued
        in: query
        description: Issued date
        required: false
        schema:
          type: string
          format: date
          description: Issued date
          examples:
          - 2021-01-01
      - name: validTo
        in: query
        description: Valid to date
        required: false
        schema:
          type: string
          format: date
          description: Valid to date
          examples:
          - 2021-12-31
      - name: status
        in: query
        description: Asset status
        required: false
        schema:
          $ref: "#/components/schemas/Status"
      - name: statusReason
        in: query
        description: Status reason
        required: false
        schema:
          type: string
          description: Status reason
          examples:
          - Status reason
      - name: description
        in: query
        description: Asset description
        required: false
        schema:
          type: string
          description: Asset description
          examples:
          - Asset description
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Asset"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    post:
      tags:
      - Draft Assets
      summary: Create a draft asset
      operationId: createDraftAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: sourceReference
        in: query
        description: "Relation reference in format (target part is ignored): '{relationType}|{sourceResourceId};{sourceType};{sourceService};{sourceNamespace}|{targetResourceId};{targetType};{targetService};{targetNamespace}'"
        required: false
        schema:
          type: string
        example: LINK|1234;case;service;MY_NAMESPACE|
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetCreateRequest"
        required: true
      responses:
        "201":
          description: Created - Successful operation
          headers:
            Location:
              description: Location of the created resource.
              style: simple
              schema:
                type: string
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/asset-drafts/{id}:
    get:
      tags:
      - Draft Assets
      summary: Get a draft asset by ID
      operationId: getDraftAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
    patch:
      tags:
      - Draft Assets
      summary: Update a draft asset
      operationId: updateDraftAsset
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DraftAssetUpdateRequest"
        required: true
      responses:
        "204":
          description: No content - Successful operation
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /{municipalityId}/metadata/statusreasons:
    get:
      tags:
      - Metadata - Statusreasons
      summary: Get all status reasons
      operationId: readAllReasons
      parameters:
      - name: municipalityId
        in: path
        description: Municipality ID
        required: true
        schema:
          type: string
        example: 2281
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                oneOf:
                - $ref: "#/components/schemas/Problem"
                - $ref: "#/components/schemas/ConstraintViolationProblem"
        "500":
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
  /api-docs:
    get:
      tags:
      - API
      summary: OpenAPI
      operationId: getApiDocs
      responses:
        "200":
          description: OK
          content:
            application/yaml:
              schema:
                type: string
      x-auth-type: None
      x-throttling-tier: Unlimited
      x-wso2-mutual-ssl: Optional
components:
  schemas:
    Status:
      type: string
      description: Status model
      enum:
      - ACTIVE
      - DRAFT
      - EXPIRED
      - BLOCKED
      - TEMPORARY
      - REPLACED
    Problem:
      type: object
      properties:
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
          format: uri
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
    ConstraintViolationProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        status:
          type: integer
          format: int32
        violations:
          type: array
          items:
            $ref: "#/components/schemas/Violation"
        title:
          type: string
        causeAsProblem:
          $ref: "#/components/schemas/ThrowableProblem"
        detail:
          type: string
        instance:
          type: string
          format: uri
    ThrowableProblem:
      type: object
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
          format: int32
        detail:
          type: string
        instance:
          type: string
          format: uri
        causeAsProblem: {}
    Violation:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
    AssetCreateRequest:
      type: object
      properties:
        assetId:
          type: string
          description: External asset id (e.g. PRH-123456789) used as an identifier
            by external systems
          examples:
          - PRH-123456789
        origin:
          type: string
          description: Source of origin for the asset
          examples:
          - CASEDATA
        partyId:
          type: string
          description: PartyId
          examples:
          - 123e4567-e89b-12d3-a456-426614174000
        type:
          type: string
          description: Asset type
          examples:
          - PERMIT
          minLength: 1
        issued:
          type: string
          format: date
          description: Issued date
          examples:
          - 2021-01-01
        validTo:
          type: string
          format: date
          description: Valid to date
          examples:
          - 2021-12-31
        status:
          $ref: "#/components/schemas/Status"
          description: Asset status
          examples:
          - ACTIVE
        statusReason:
          type: string
          description: Status reason
          examples:
          - Status reason
        description:
          type: string
          description: Asset description
          examples:
          - Asset description
        additionalParameters:
          type: object
          additionalProperties:
            type: string
          description: Additional parameters
          examples:
          - foo: bar
        jsonParameters:
          type: array
          description: JSON parameters
          items:
            $ref: "#/components/schemas/AssetJsonParameter"
      required:
      - issued
      - partyId
      - status
      - type
    AssetJsonParameter:
      type: object
      properties:
        key:
          type: string
          description: Parameter key
          examples:
          - personParameter
          minLength: 1
        value:
          $ref: "#/components/schemas/JsonNode"
          description: Parameter value with the JSON structure
          example:
            firstName: Joe
            lastName: Doe
        schemaId:
          type: string
          description: Schema ID
          examples:
          - person_1.0
          minLength: 1
      required:
      - key
      - schemaId
      - value
    JsonNode:
      type: object
      properties:
        number:
          type: boolean
        nodeType:
          type: string
          enum:
          - ARRAY
          - BINARY
          - BOOLEAN
          - MISSING
          - "NULL"
          - NUMBER
          - OBJECT
          - POJO
          - STRING
        string:
          type: boolean
        integralNumber:
          type: boolean
        missingNode:
          type: boolean
        valueNode:
          type: boolean
        pojo:
          type: boolean
        short:
          type: boolean
        int:
          type: boolean
        long:
          type: boolean
        double:
          type: boolean
        bigDecimal:
          type: boolean
        bigInteger:
          type: boolean
        textual:
          type: boolean
          deprecated: true
        boolean:
          type: boolean
        binary:
          type: boolean
        container:
          type: boolean
        floatingPointNumber:
          type: boolean
        empty:
          type: boolean
        array:
          type: boolean
        "null":
          type: boolean
        object:
          type: boolean
        float:
          type: boolean
        embeddedValue:
          type: boolean
    AssetUpdateRequest:
      type: object
      properties:
        status:
          $ref: "#/components/schemas/Status"
          description: Asset status
          examples:
          - ACTIVE
        statusReason:
          type: string
          description: Status reason
          examples:
          - Status reason
    DraftAssetUpdateRequest:
      type: object
      properties:
        issued:
          type: string
          format: date
          description: Issued date
          examples:
          - 2021-01-01
        validTo:
          type: string
          format: date
          description: Valid to date
          examples:
          - 2021-12-31
        indefinitely:
          type: boolean
          description: "If true, validTo will be cleared (asset becomes indefinite).\
            \ Takes precedence over validTo when both are supplied."
          examples:
          - "true"
        status:
          $ref: "#/components/schemas/Status"
          description: Asset status
          examples:
          - ACTIVE
        statusReason:
          type: string
          description: Status reason
          examples:
          - Status reason
        additionalParameters:
          type: object
          additionalProperties:
            type: string
          description: Additional parameters
          examples:
          - foo: bar
        jsonParameters:
          type: array
          description: JSON parameters
          items:
            $ref: "#/components/schemas/AssetJsonParameter"
    Asset:
      type: object
      properties:
        id:
          type: string
          description: Unique id of asset
          examples:
          - 1c8f38a6-b492-4037-b7dc-de5bc6c629f0
        assetId:
          type: string
          description: External asset id (e.g. PRH-123456789) used as an identifier
            by external systems
          examples:
          - PRH-123456789
        origin:
          type: string
          description: Source of origin for the asset
          examples:
          - CASEDATA
        partyId:
          type: string
          description: PartyId
          examples:
          - 123e4567-e89b-12d3-a456-426614174000
        type:
          type: string
          description: Asset type
          examples:
          - PERMIT
        issued:
          type: string
          format: date
          description: Issued date
          examples:
          - 2021-01-01
        validTo:
          type: string
          format: date
          description: Valid to date
          examples:
          - 2021-12-31
        status:
          $ref: "#/components/schemas/Status"
          description: Asset status
          examples:
          - ACTIVE
        statusReason:
          type: string
          description: Status reason
          examples:
          - Status reason
        description:
          type: string
          description: Asset description
          examples:
          - Asset description
        additionalParameters:
          type: object
          additionalProperties:
            type: string
          description: Additional parameters
          examples:
          - foo: bar
        jsonParameters:
          type: array
          description: JSON parameters
          items:
            $ref: "#/components/schemas/AssetJsonParameter"
        replacesId:
          type: string
          description: Id of the asset this asset replaces
          examples:
          - 1c8f38a6-b492-4037-b7dc-de5bc6c629f0
  securitySchemes: {}
