openapi: 3.1.0
info:
  title: Dashboard Recovery Posture Honesty Surface Contracts
  version: 1.0.0
  description: >-
    Internal reference contract for tenant dashboard recovery-posture honesty.
    The application continues to return rendered HTML through Filament and
    Livewire. The vendor media types below document the structured dashboard and
    restore-history models that must be derivable before rendering. This is not
    a public API commitment.
paths:
  /admin/t/{tenant}:
    get:
      summary: Tenant dashboard recovery-posture summary surface
      description: >-
        Returns the rendered tenant dashboard. The vendor media type documents
        the backup posture, recovery-evidence summary, and recovery-related
        attention or healthy-check state that must be available before rendering.
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Rendered tenant dashboard page
          content:
            text/html:
              schema:
                type: string
            application/vnd.tenantpilot.dashboard-recovery-posture+json:
              schema:
                $ref: '#/components/schemas/TenantDashboardRecoverySurface'
        '403':
          description: Viewer is in scope but lacks the capability required for the dashboard surface
        '404':
          description: Tenant scope is not visible because workspace or tenant membership is missing
  /admin/t/{tenant}/restore-runs:
    get:
      summary: Restore history collection surface with recovery continuity context
      description: >-
        Returns the rendered restore-run list. The vendor media type documents
        the continuity subheading and result-attention facts needed to confirm a
        dashboard recovery signal.
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            type: integer
        - name: recovery_posture_reason
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/RecoveryPostureReason'
      responses:
        '200':
          description: Rendered restore-run list page
          content:
            text/html:
              schema:
                type: string
            application/vnd.tenantpilot.restore-history-collection+json:
              schema:
                $ref: '#/components/schemas/RestoreHistoryCollectionSurface'
        '403':
          description: Viewer is in scope but lacks restore-history viewing capability
        '404':
          description: Restore history is not visible because workspace or tenant membership is missing
  /admin/t/{tenant}/restore-runs/{restoreRun}:
    get:
      summary: Restore history detail surface
      description: >-
        Returns the rendered restore-run detail page. The vendor media type
        documents the result-attention and claim-boundary facts that confirm a
        specific dashboard recovery signal.
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            type: integer
        - name: restoreRun
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Rendered restore-run detail page
          content:
            text/html:
              schema:
                type: string
            application/vnd.tenantpilot.restore-history-detail+json:
              schema:
                $ref: '#/components/schemas/RestoreHistoryDetailSurface'
        '403':
          description: Viewer is in scope but lacks capability for the restore-run detail surface
        '404':
          description: Restore run is not visible because workspace or tenant membership is missing
components:
  schemas:
    TenantDashboardRecoverySurface:
      type: object
      required:
        - backupPosture
        - recoveryEvidence
      properties:
        backupPosture:
          $ref: '#/components/schemas/BackupPostureStat'
        recoveryEvidence:
          $ref: '#/components/schemas/RecoveryEvidenceSummary'
        needsAttentionItems:
          type: array
          items:
            $ref: '#/components/schemas/RecoveryAttentionItem'
        healthyChecks:
          type: array
          items:
            $ref: '#/components/schemas/HealthyCheck'
    BackupPostureStat:
      type: object
      required:
        - label
        - posture
        - summary
        - claimBoundary
      properties:
        label:
          type: string
        posture:
          type: string
          enum:
            - absent
            - stale
            - degraded
            - healthy
        summary:
          type: string
        claimBoundary:
          type: string
        action:
          oneOf:
            - $ref: '#/components/schemas/ActionLink'
            - type: 'null'
    RecoveryEvidenceSummary:
      type: object
      required:
        - state
        - headline
        - summary
        - claimBoundary
      properties:
        state:
          type: string
          description: Canonical recovery-evidence state key for the dashboard surface.
          enum:
            - unvalidated
            - weakened
            - no_recent_issues_visible
        headline:
          type: string
        summary:
          type: string
        claimBoundary:
          type: string
        latestRelevantRestoreRunId:
          type:
            - integer
            - 'null'
        latestRelevantAttentionState:
          type:
            - string
            - 'null'
          enum:
            - failed
            - partial
            - completed_with_follow_up
            - completed
            - null
        action:
          oneOf:
            - $ref: '#/components/schemas/ActionLink'
            - type: 'null'
    RecoveryAttentionItem:
      type: object
      required:
        - title
        - body
        - badge
        - badgeColor
      properties:
        title:
          type: string
        body:
          type: string
        supportingMessage:
          type:
            - string
            - 'null'
        badge:
          type: string
        badgeColor:
          type: string
        action:
          oneOf:
            - $ref: '#/components/schemas/ActionLink'
            - type: 'null'
    HealthyCheck:
      type: object
      required:
        - title
        - body
      properties:
        title:
          type: string
        body:
          type: string
    RestoreHistoryCollectionSurface:
      type: object
      required:
        - rows
      properties:
        subheading:
          type:
            - string
            - 'null'
        rows:
          type: array
          items:
            $ref: '#/components/schemas/RestoreHistoryRow'
        emptyState:
          oneOf:
            - $ref: '#/components/schemas/EmptyState'
            - type: 'null'
    RestoreHistoryRow:
      type: object
      required:
        - id
        - status
        - resultAttention
      properties:
        id:
          type: integer
        backupSetName:
          type:
            - string
            - 'null'
        status:
          type: string
        completedAt:
          type:
            - string
            - 'null'
          format: date-time
        requestedBy:
          type:
            - string
            - 'null'
        resultAttention:
          $ref: '#/components/schemas/ResultAttentionFact'
        action:
          oneOf:
            - $ref: '#/components/schemas/ActionLink'
            - type: 'null'
    RestoreHistoryDetailSurface:
      type: object
      required:
        - header
        - resultAttention
      properties:
        header:
          $ref: '#/components/schemas/RestoreHistoryHeader'
        resultAttention:
          $ref: '#/components/schemas/ResultAttentionFact'
        relatedLinks:
          type: array
          items:
            $ref: '#/components/schemas/ActionLink'
    RestoreHistoryHeader:
      type: object
      required:
        - id
        - status
      properties:
        id:
          type: integer
        status:
          type: string
        completedAt:
          type:
            - string
            - 'null'
          format: date-time
        backupSetName:
          type:
            - string
            - 'null'
    ResultAttentionFact:
      type: object
      required:
        - state
        - summary
        - followUpRequired
        - claimBoundary
      properties:
        state:
          type: string
          enum:
            - not_executed
            - failed
            - partial
            - completed_with_follow_up
            - completed
        summary:
          type: string
        followUpRequired:
          type: boolean
        claimBoundary:
          type: string
        primaryNextAction:
          type:
            - string
            - 'null'
    EmptyState:
      type: object
      required:
        - title
        - body
      properties:
        title:
          type: string
        body:
          type: string
        action:
          oneOf:
            - $ref: '#/components/schemas/ActionLink'
            - type: 'null'
    ActionLink:
      type: object
      required:
        - label
        - disabled
      properties:
        label:
          type: string
        url:
          type:
            - string
            - 'null'
        disabled:
          type: boolean
        helperText:
          type:
            - string
            - 'null'
    RecoveryPostureReason:
      type: string
      enum:
        - no_history
        - failed
        - partial
        - completed_with_follow_up
        - no_recent_issues_visible