openapi: 3.0.1
info:
  description: This is the diagnostics description.
  title: Diagnostics
  version: '5.1'
servers:
  - url: https://api.envizage.me
paths:
  /results/{scenarioId}/query/diagnostics/goal:
    get:
      description: Get diagnostic query results
      operationId: getAll
      parameters:
        - description: The scenario's id
          in: path
          name: scenarioId
          required: true
          schema:
            type: string
        - description: Zero-based page index (0..N)
          in: query
          name: page
          schema:
            type: integer
            default: 0
        - description: The size of the page to be returned
          in: query
          name: size
          schema:
            type: integer
            default: 20
        - description: >-
            Sorting criteria in the format: property,(asc|desc). Default sort
            order is ascending. Multiple sort criteria are supported.
          in: query
          name: sort
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageDiagnosticQueryResultDto'
          description: OK
        '500':
          description: Internal Server Error
      security:
        - authentication:
            - scenarios:full
            - scenarios:read
      summary: Get diagnostic query results
      tags:
        - Diagnostic query
  /results/{scenarioId}/query/diagnostics/goal/{goalId}:
    get:
      description: Get diagnostic query results for goal by goal id
      operationId: getAllByGoalId
      parameters:
        - description: The scenario's id
          in: path
          name: scenarioId
          required: true
          schema:
            type: string
        - description: The goal's id
          in: path
          name: goalId
          required: true
          schema:
            type: string
        - description: List of diagnostic types
          in: query
          name: diagnosticTypes
          required: true
          schema:
            type: array
            items:
              type: string
              enum:
                - EXPENSE_LIVING_EXPENSES_DECREASE
                - EXPENSE_RENT_VS_MORTGAGE_ON_RESIDENTIAL_PROPERTY
                - EXPENSE_MORTGAGE_ON_RESIDENTIAL_PROPERTY_VS_RENT
                - INCOME_EARNED_INCOME_INCREASE_PRIMARY
                - INCOME_EARNED_INCOME_INCREASE_PARTNER
                - INCOME_WORK_PART_TIME_AFTER_RETIREMENT_PRIMARY
                - INCOME_WORK_PART_TIME_AFTER_RETIREMENT_PARTNER
                - GOAL_SWITCH_OFF_EARLIER_GOALS
                - GOAL_SPEND_LESS_MONEY_ON_GOAL
                - GOAL_MOVE_IT_TO_THE_FUTURE
                - GOAL_BUY_A_HOUSE_DOWNPAYMENT
                - GOAL_BUY_A_HOUSE_MORTGAGE_AFFORDABILITY
                - GOAL_BORROW
                - GOAL_SAVE_IN_YEARS
                - PROPERTY_MOVE_TO_SMALLER_PROPERTY
                - PROPERTY_SELL_BUY_TO_LET_PROPERTIES
                - DEBT_RESIDENTIAL_PROPERTIES_REMORTGAGE
                - DEBT_INVESTMENT_PROPERTIES_REMORTGAGE
                - DEBT_ELIMINATE_DEBT
                - WRAPPER_TAX_ADVANTAGED_RISK_INCREASE_PRIMARY
                - WRAPPER_TAX_ADVANTAGED_RISK_INCREASE_PARTNER
                - WRAPPER_TAX_ADVANTAGED_RISK_DECREASE_PRIMARY
                - WRAPPER_TAX_ADVANTAGED_RISK_DECREASE_PARTNER
                - WRAPPER_GIA_RISK_INCREASE_PRIMARY
                - WRAPPER_GIA_RISK_INCREASE_PARTNER
                - WRAPPER_GIA_RISK_DECREASE_PRIMARY
                - WRAPPER_GIA_RISK_DECREASE_PARTNER
                - WRAPPER_PENSION_RISK_INCREASE_PRIMARY
                - WRAPPER_PENSION_RISK_INCREASE_PARTNER
                - WRAPPER_PENSION_RISK_DECREASE_PRIMARY
                - WRAPPER_PENSION_RISK_DECREASE_PARTNER
                - WRAPPER_PENSION_CONTRIBUTION_INCREASE_PRIMARY
                - WRAPPER_PENSION_CONTRIBUTION_INCREASE_PARTNER
                - SAVINGS_TAX_ADVANTAGED_INVESTMENTS_ENABLE_PRIMARY
                - SAVINGS_TAX_ADVANTAGED_INVESTMENTS_ENABLE_PARTNER
                - SAVINGS_GIA_INVESTMENTS_ENABLE_PRIMARY
                - SAVINGS_GIA_INVESTMENTS_ENABLE_PARTNER
                - INSURANCE_TERM_LIFE_INSURANCE_INCREASE_PRIMARY
                - INSURANCE_TERM_LIFE_INSURANCE_INCREASE_PARTNER
                - INSURANCE_DISABILITY_INSURANCE_INCREASE_PRIMARY
                - INSURANCE_DISABILITY_INSURANCE_INCREASE_PARTNER
                - INSURANCE_CRITICAL_ILLNESS_INSURANCE_INCREASE_PRIMARY
                - INSURANCE_CRITICAL_ILLNESS_INSURANCE_INCREASE_PARTNER
                - INSURANCE_MORTGAGE_LIFE_INSURANCE_INCREASE
                - LIFESTYLE_TOO_UNHEALTHY_PRIMARY
                - LIFESTYLE_TOO_UNHEALTHY_PARTNER
                - NONE
        - description: Zero-based page index (0..N)
          in: query
          name: page
          schema:
            type: integer
            default: 0
        - description: The size of the page to be returned
          in: query
          name: size
          schema:
            type: integer
            default: 20
        - description: >-
            Sorting criteria in the format: property,(asc|desc). Default sort
            order is ascending. Multiple sort criteria are supported.
          in: query
          name: sort
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageDiagnosticQueryResultDto'
          description: OK
        '500':
          description: Internal Server Error
      security:
        - authentication:
            - scenarios:full
            - scenarios:read
      summary: Get diagnostic query results for goal
      tags:
        - Diagnostic query
components:
  schemas:
    DiagnosticQueryResultDto:
      type: object
      properties:
        clientId:
          type: string
        description:
          type: string
        diagnosticType:
          type: string
          enum:
            - EXPENSE_LIVING_EXPENSES_DECREASE
            - EXPENSE_RENT_VS_MORTGAGE_ON_RESIDENTIAL_PROPERTY
            - EXPENSE_MORTGAGE_ON_RESIDENTIAL_PROPERTY_VS_RENT
            - INCOME_EARNED_INCOME_INCREASE_PRIMARY
            - INCOME_EARNED_INCOME_INCREASE_PARTNER
            - INCOME_WORK_PART_TIME_AFTER_RETIREMENT_PRIMARY
            - INCOME_WORK_PART_TIME_AFTER_RETIREMENT_PARTNER
            - GOAL_SWITCH_OFF_EARLIER_GOALS
            - GOAL_SPEND_LESS_MONEY_ON_GOAL
            - GOAL_MOVE_IT_TO_THE_FUTURE
            - GOAL_BUY_A_HOUSE_DOWNPAYMENT
            - GOAL_BUY_A_HOUSE_MORTGAGE_AFFORDABILITY
            - GOAL_BORROW
            - GOAL_SAVE_IN_YEARS
            - PROPERTY_MOVE_TO_SMALLER_PROPERTY
            - PROPERTY_SELL_BUY_TO_LET_PROPERTIES
            - DEBT_RESIDENTIAL_PROPERTIES_REMORTGAGE
            - DEBT_INVESTMENT_PROPERTIES_REMORTGAGE
            - DEBT_ELIMINATE_DEBT
            - WRAPPER_TAX_ADVANTAGED_RISK_INCREASE_PRIMARY
            - WRAPPER_TAX_ADVANTAGED_RISK_INCREASE_PARTNER
            - WRAPPER_TAX_ADVANTAGED_RISK_DECREASE_PRIMARY
            - WRAPPER_TAX_ADVANTAGED_RISK_DECREASE_PARTNER
            - WRAPPER_GIA_RISK_INCREASE_PRIMARY
            - WRAPPER_GIA_RISK_INCREASE_PARTNER
            - WRAPPER_GIA_RISK_DECREASE_PRIMARY
            - WRAPPER_GIA_RISK_DECREASE_PARTNER
            - WRAPPER_PENSION_RISK_INCREASE_PRIMARY
            - WRAPPER_PENSION_RISK_INCREASE_PARTNER
            - WRAPPER_PENSION_RISK_DECREASE_PRIMARY
            - WRAPPER_PENSION_RISK_DECREASE_PARTNER
            - WRAPPER_PENSION_CONTRIBUTION_INCREASE_PRIMARY
            - WRAPPER_PENSION_CONTRIBUTION_INCREASE_PARTNER
            - SAVINGS_TAX_ADVANTAGED_INVESTMENTS_ENABLE_PRIMARY
            - SAVINGS_TAX_ADVANTAGED_INVESTMENTS_ENABLE_PARTNER
            - SAVINGS_GIA_INVESTMENTS_ENABLE_PRIMARY
            - SAVINGS_GIA_INVESTMENTS_ENABLE_PARTNER
            - INSURANCE_TERM_LIFE_INSURANCE_INCREASE_PRIMARY
            - INSURANCE_TERM_LIFE_INSURANCE_INCREASE_PARTNER
            - INSURANCE_DISABILITY_INSURANCE_INCREASE_PRIMARY
            - INSURANCE_DISABILITY_INSURANCE_INCREASE_PARTNER
            - INSURANCE_CRITICAL_ILLNESS_INSURANCE_INCREASE_PRIMARY
            - INSURANCE_CRITICAL_ILLNESS_INSURANCE_INCREASE_PARTNER
            - INSURANCE_MORTGAGE_LIFE_INSURANCE_INCREASE
            - LIFESTYLE_TOO_UNHEALTHY_PRIMARY
            - LIFESTYLE_TOO_UNHEALTHY_PARTNER
            - NONE
        goalId:
          type: string
        id:
          type: string
        name:
          type: string
        results:
          type: array
          items:
            $ref: '#/components/schemas/QueryResult'
        scenarioId:
          type: string
        simulationId:
          type: string
        username:
          type: string
      required:
        - clientId
        - diagnosticType
        - goalId
        - results
        - scenarioId
    PageDiagnosticQueryResultDto:
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/DiagnosticQueryResultDto'
        empty:
          type: boolean
        first:
          type: boolean
        last:
          type: boolean
        number:
          type: integer
          format: int32
        numberOfElements:
          type: integer
          format: int32
        pageable:
          $ref: '#/components/schemas/PageableObject'
        size:
          type: integer
          format: int32
        sort:
          $ref: '#/components/schemas/SortObject'
        totalElements:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
    PageableObject:
      type: object
      properties:
        offset:
          type: integer
          format: int64
        pageNumber:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        paged:
          type: boolean
        sort:
          $ref: '#/components/schemas/SortObject'
        unpaged:
          type: boolean
    QueryData:
      type: object
      properties:
        data:
          type: object
          additionalProperties:
            type: object
        goalId:
          type: string
        lifeId:
          type: integer
          format: int32
        timestepId:
          type: integer
          format: int32
    QueryResult:
      type: object
      properties:
        name:
          type: string
        results:
          type: array
          items:
            $ref: '#/components/schemas/QueryData'
    SortObject:
      type: object
      properties:
        empty:
          type: boolean
        sorted:
          type: boolean
        unsorted:
          type: boolean
  securitySchemes:
    authentication:
      bearerFormat: JWT
      openIdConnectUrl: https://id.envizage.me/realms/my-realm
      scheme: Bearer
      type: openIdConnect
