---
openapi: 3.1.0
info:
  contact:
    email: sascha@skyyware.com
    name: Skyyware
  title: PensionMesh API
  version: 1.0.0
tags:
- name: Program
  description: Program status and target architecture
- name: Cases
  description: Pension-domain analysis cases
- name: PensionMesh
components:
  schemas:
    ArchitectureAssessment:
      type: object
      properties:
        id:
          type: string
        author:
          type: string
        decision:
          type: string
        summary:
          type: string
        riskDelta:
          type: integer
          format: int32
        createdAt:
          $ref: "#/components/schemas/Instant"
    ArchitectureBlueprint:
      type: object
      properties:
        capabilities:
          type: array
          items:
            type: string
        microProfileStandards:
          type: array
          items:
            type: string
        serviceMesh:
          type: string
        persistenceStrategy:
          type: string
        integrationBoundaries:
          type: array
          items:
            type: string
    CreateAssessmentRequest:
      type: object
      required:
      - author
      - decision
      - summary
      properties:
        author:
          type: string
          pattern: \S
        decision:
          type: string
          pattern: \S
        summary:
          type: string
          pattern: \S
        riskDelta:
          type: integer
          format: int32
          maximum: 30
          minimum: -30
    DataStoreProfile:
      type: object
      properties:
        engine:
          type: string
        role:
          type: string
        schemaStrategy:
          type: string
        portabilityRisk:
          type: string
        migrationNote:
          type: string
    Instant:
      type: string
      format: date-time
      examples:
      - 2022-03-10T16:15:50Z
    MeshPolicy:
      type: object
      properties:
        name:
          type: string
        trafficPolicy:
          type: string
        securityMode:
          type: string
        observability:
          type: string
        rolloutMode:
          type: string
    PensionCase:
      type: object
      properties:
        id:
          type: string
        caseNumber:
          type: string
        domain:
          type: string
        region:
          type: string
        productLine:
          type: string
        complexity:
          type: string
        status:
          type: string
        owner:
          type: string
        targetArchitectureScore:
          type: integer
          format: int32
        nextDecision:
          type: string
        riskFlags:
          type: array
          items:
            type: string
        targetServices:
          type: array
          items:
            $ref: "#/components/schemas/ServiceCandidate"
        dataStores:
          type: array
          items:
            $ref: "#/components/schemas/DataStoreProfile"
        assessments:
          type: array
          items:
            $ref: "#/components/schemas/ArchitectureAssessment"
        events:
          type: array
          items:
            $ref: "#/components/schemas/ProgramEvent"
        updatedAt:
          $ref: "#/components/schemas/Instant"
    ProgramEvent:
      type: object
      properties:
        id:
          type: string
        caseId:
          type: string
        type:
          type: string
        summary:
          type: string
        source:
          type: string
        createdAt:
          $ref: "#/components/schemas/Instant"
    ProgramStatus:
      type: object
      properties:
        status:
          type: string
        environment:
          type: string
        openCases:
          type: integer
          format: int32
        highComplexityCases:
          type: integer
          format: int32
        serviceCandidates:
          type: integer
          format: int32
        eventBacklog:
          type: integer
          format: int32
        persistenceStrategy:
          type: string
        generatedAt:
          $ref: "#/components/schemas/Instant"
    ServiceCandidate:
      type: object
      properties:
        name:
          type: string
        boundedContext:
          type: string
        runtime:
          type: string
        apiStyle:
          type: string
        persistence:
          type: string
        meshPolicy:
          type: string
        state:
          type: string
paths:
  /api/architecture/blueprint:
    get:
      summary: Target architecture blueprint
      tags:
      - PensionMesh
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ArchitectureBlueprint"
  /api/cases:
    get:
      summary: Architecture cases sorted by risk
      tags:
      - PensionMesh
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/PensionCase"
  /api/cases/{caseId}:
    get:
      summary: Single pension architecture case
      tags:
      - PensionMesh
      parameters:
      - name: caseId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PensionCase"
  /api/cases/{caseId}/assessments:
    post:
      summary: Record architecture assessment
      tags:
      - PensionMesh
      parameters:
      - name: caseId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAssessmentRequest"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
        "400":
          description: Bad Request
  /api/service-mesh/policies:
    get:
      summary: Service-mesh policy model
      tags:
      - PensionMesh
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/MeshPolicy"
  /api/status:
    get:
      summary: Program status and runtime metadata
      tags:
      - PensionMesh
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProgramStatus"
