openapi: 3.0.3
info:
  title: Registry regulations admin-portal
  description: This document describes REST API of 'Registry regulations admin-portal'
  version: '1.0'
servers:
  - url: http://localhost:7070
    description: Generated server url
paths:
  /versions/master/business-process-groups:
    get:
      tags:
        - Registry regulations master Business process Groups management Rest API
      summary: Get Business Process Groups for master version
      operationId: getBusinessProcessGroupsFromMaster
      parameters:
        - name: X-Access-Token
          in: header
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessProcessGroupsResponse'
        '401':
          description: Unauthorized
          content:
            application/json: {}
        '403':
          description: Forbidden
          content:
            application/json: {}
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'            
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'
  /versions/candidates/{versionCandidateId}/business-process-groups:
    get:
      tags:
        - Registry regulations version-candidate Business process Groups management Rest API
      summary: Get Business Process Groups
      operationId: getBusinessProcessGroups
      parameters:
        - name: X-Access-Token
          in: header
          schema:
            type: string
        - name: versionCandidateId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessProcessGroupsResponse'
        '401':
          description: Unauthorized
          content:
            application/json: {}
        '403':
          description: Forbidden
          content:
            application/json: {}
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'            
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'
    post:
      tags:
        - Registry regulations version-candidate Business process Groups management Rest API
      summary: Create or replace Business Process Groups
      operationId: groupsCreate
      parameters:
        - name: X-Access-Token
          in: header
          schema:
            type: string
        - name: versionCandidateId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BusinessProcessGroups'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json: {}
        '401':
          description: Unauthorized
          content:
            application/json: {}
        '403':
          description: Forbidden
          content:
            application/json: {}
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'
  /versions/candidates/{versionCandidateId}/changes:
    get:
      tags:
        - Registry regulations version-candidate management Rest API
      description: Get version changes by id
      operationId: getVersionChanges
      parameters:
        - name: X-Access-Token
          in: header
          description: Token used for endpoint security
          required: true
          schema:
            type: string
        - name: versionCandidateId
          in: path
          description: Version candidate identifier
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VersionChangesDto'
        '401':
          description: Unauthorized
          content:
            application/json: {}
        '403':
          description: Forbidden
          content:
            application/json: {}
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedErrorResponse'
components:
  schemas:
    DetailedErrorResponse:
      type: object
      properties:
        traceId:
          type: string
        code:
          type: string
        details:
          type: string
        localizedMessage:
          type: string
    BusinessProcessGroups:
      type: object
      properties:
        groups:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              processDefinitions:
                type: array
                items:
                  type: string
        ungrouped:
          type: array
          items:
            type: string
    BusinessProcessGroupsResponse:
      type: object
      properties:
        groups:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              processDefinitions:
                type: array
                items:
                  $ref: '#/components/schemas/ProcessDefinition'
        ungrouped:
          type: array
          items:
            $ref: '#/components/schemas/ProcessDefinition'            
    ProcessDefinition:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    EntityChangesInfoDto:
      type: object
      properties:
        name:
          type: string
        title:
          type: string
        status:
          type: string
          enum:
            - NEW
            - CHANGED
            - CURRENT
            - DELETED
    VersionChangesDto:
      type: object
      properties:
        changedForms:
          type: array
          items:
            $ref: '#/components/schemas/EntityChangesInfoDto'
        changedBusinessProcesses:
          type: array
          items:
            $ref: '#/components/schemas/EntityChangesInfoDto'
        changedGroups:
          type: array
          items:
            $ref: '#/components/schemas/EntityChangesInfoDto'